Database.new_column

Database.new_column(table_name: str, column_name: str, data_type: lab_utils.database.DataType, constraints: Optional[list] = None)[source]

Creates a new column in a given table.

If the column already exists, it just returns. If the table does not exist or the column could not be created, it raises a psycopg2.Error.

Parameters
  • table_name (str) – Name of the table where the column has to be created

  • column_name (str) – Name of the column to be created

  • data_type (DataType) – Data type of the new column

  • constraints (list, optional) – List of Constraints, default is ‘None’

Raises