create_table

Data_Reduction.GAVRT.mysql.create_table(database, name, keys)

Creates a table with the specified column names and types.

Here’s an example:

name = "customers"
keys = {'name':    'CHAR(20 NOT NULL'),
        'job':     'VARCHAR(20)',
        'sex':     "ENUM('M','F')",
        'hobbies': "SET('chess','sailing','reading','knitting')",
        'birth':   'DATE',
        'balance': 'FLOAT'}
create_table(someDatabase,name,keys)

When a column name conflicts with a MySQL reserved word, the name is put in backward quotes. This keeps the column name possibilities from being too restricted, e.g., dec.

This exists from a time prior to when I started using ‘tedia2sql’ to create tables and may still be useful in simple situations.

:param database : the database for the new table :param name : the table name :param keys : a dictionary with the column names and formats.