The column module defines two classes, Column derived from DbSchemaObject and ColumnDict, derived from DbObjectDict.
Column is derived from DbSchemaObject and represents a column in a table, or an attribute in a composite type. Its keylist attributes are the schema name and the table name.
A Column has the following attributes: name, type, not_null and default. The number attribute is also present but is not made visible externally.
A table column definition
Convert a column to a YAML-suitable format
| Parameters: | no_privs – exclude privilege information |
|---|---|
| Returns: | dictionary |
Return a string to specify the column in a CREATE or ALTER TABLE
| Returns: | partial SQL statement |
|---|
Generate SQL statements to grant privileges on new column
| Returns: | list of SQL statements |
|---|
Generate SQL statements to grant or revoke privileges
| Parameters: | incol – a YAML map defining the input column |
|---|---|
| Returns: | list of SQL statements |
Return a SQL COMMENT statement for the column
| Returns: | SQL statement |
|---|
Return string to drop the column via ALTER TABLE
| Returns: | SQL statement |
|---|
Return SQL statement to RENAME the column
| Parameters: | newname – the new name of the object |
|---|---|
| Returns: | SQL statement |
Return SQL statements to set a nextval() DEFAULT
| Returns: | list of SQL statements |
|---|
Generate SQL to transform an existing column
| Parameters: | insequence – a YAML map defining the new column |
|---|---|
| Returns: | list of partial SQL statements |
Compares the column to an input column and generates partial SQL statements to transform it into the one represented by the input.
Class ColumnDict is a dictionary derived from DbObjectDict and represents the collection of columns in a database, across multiple tables. It is indexed by the schema name and table name, and each value is a list of Column objects.
The collection of columns in tables in a database
Initialize the dictionary of columns by converting the input list
| Parameters: |
|
|---|