FieldSpec¶
-
class
lsst.daf.butler.FieldSpec(name: str, dtype: type, length: Optional[int] = None, nbytes: Optional[int] = None, primaryKey: bool = False, autoincrement: bool = False, nullable: bool = True, doc: Optional[str] = None)¶ Bases:
objectA struct-like class used to define a column in a logical Registry table.
Attributes Summary
autoincrementWhether the database should insert automatically incremented values when no value is provided in an INSERT. docDocumentation for this field. lengthLength of the type in the database, for variable-length types. nbytesNatural length used for hash and encoded-region columns, to be converted into the post-encoding length. nullableWhether this field is allowed to be NULL. primaryKeyWhether this field is (part of) its table’s primary key. Methods Summary
fromConfig(config, *args, **kwds)getSizedColumnType()Return a sized version of the column type, utilizing either (or neither) of self.lengthandself.nbytes.toSqlAlchemy(tableName, schema)Construct a SQLAlchemy Columnobject from this specification.Attributes Documentation
-
autoincrement= False¶ Whether the database should insert automatically incremented values when no value is provided in an INSERT.
-
doc= None¶ Documentation for this field.
-
length= None¶ Length of the type in the database, for variable-length types.
-
nbytes= None¶ Natural length used for hash and encoded-region columns, to be converted into the post-encoding length.
-
nullable= True¶ Whether this field is allowed to be NULL.
-
primaryKey= False¶ Whether this field is (part of) its table’s primary key.
Methods Documentation
-
classmethod
fromConfig(config, *args, **kwds)¶
-
getSizedColumnType() → sqlalchemy.sql.type_api.TypeEngine¶ Return a sized version of the column type, utilizing either (or neither) of
self.lengthandself.nbytes.Returns: - dtype :
sqlalchemy.types.TypeEngine A SQLAlchemy column type object.
- dtype :
-
toSqlAlchemy(tableName: str, schema: lsst.daf.butler.core.schema.Schema) → sqlalchemy.sql.schema.Column¶ Construct a SQLAlchemy
Columnobject from this specification.Parameters: Returns: - column :
sqlalchemy.Column SQLAlchemy column object.
- column :
-