SchemaBuilder¶
-
class
lsst.daf.butler.
SchemaBuilder
¶ Bases:
object
Builds a Schema step-by-step.
Attributes: Attributes Summary
VALID_COLUMN_TYPES
Methods Summary
addColumn
(table, columnDescription)Add a column to a table. addForeignKeyConstraint
(table, …)Add a ForeignKeyConstraint to a table. addTable
(tableName, tableDescription)Add a table to the schema metadata. makeColumn
(columnDescription)Make a Column entry for addition to a Table. makeForeignKeyConstraint
(constraintDescription)Make a ForeignKeyConstraint for addition to a Table. Attributes Documentation
-
VALID_COLUMN_TYPES
= {'blob': <class 'sqlalchemy.sql.sqltypes.LargeBinary'>, 'bool': <class 'sqlalchemy.sql.sqltypes.Boolean'>, 'datetime': <class 'sqlalchemy.sql.sqltypes.DateTime'>, 'float': <class 'sqlalchemy.sql.sqltypes.Float'>, 'int': <class 'sqlalchemy.sql.sqltypes.Integer'>, 'region': <class 'sqlalchemy.sql.sqltypes.LargeBinary'>, 'string': <class 'sqlalchemy.sql.sqltypes.String'>}¶
Methods Documentation
-
addColumn
(table, columnDescription)¶ Add a column to a table.
Parameters: - table :
sqlalchemy.Table
,sqlalchemy.expression.TableClause
orstr
The table.
- columnDescription :
dict
Description of the column to be created. Should always contain: - name, descriptive name - type, valid column type May contain: - nullable, entry can be null - primary_key, mark this column as primary key - foreign_key, link to other table - doc, docstring
- table :
-
addForeignKeyConstraint
(table, constraintDescription)¶ Add a ForeignKeyConstraint to a table.
Parameters:
-
addTable
(tableName, tableDescription)¶ Add a table to the schema metadata.
Parameters: Raises: - ValueError
If a table with the given name already exists.
-
makeColumn
(columnDescription)¶ Make a Column entry for addition to a Table.
Parameters: - columnDescription :
dict
Description of the column to be created. Should always contain: - name, descriptive name - type, valid column type May contain: - nullable, entry can be null - primary_key, mark this column as primary key - doc, docstring
Returns: - c :
sqlalchemy.Column
The created
Column
entry.
Raises: - ValueError
If the column description contains unsupported arguments
- columnDescription :
-