neurobooth_terra.create_table

neurobooth_terra.create_table(table_id, conn, column_names, dtypes, primary_key=None, foreign_key=None, index=None)[source]

Create a table.

Parameters
table_idstr

The table ID

conninstance of psycopg2.Postgres

The connection object

column_nameslist of str

The columns to create

dtypeslist of str

The datatypes

primary_keystr | None | list

The primary key. If None, the first column name is used as primary key. If list, then primary key is a combination of the columns in the list.

foreign_keydict

Foreign key referring to another table. The key is the name of the foreign key and value is the table it refers to.

indexdict of list | None

The key is the name of the index and values are the column names on which to create the unique index.