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:
object
A struct-like class used to define a column in a logical Registry table.
Attributes Summary
Whether the database should insert automatically incremented values when no value is provided in an INSERT.
Documentation for this field.
Length of the type in the database, for variable-length types.
Natural length used for hash and encoded-region columns, to be converted into the post-encoding length.
Whether this field is allowed to be NULL.
Whether this field is (part of) its table’s primary key.
Methods Summary
fromConfig
(config, *args, **kwds)Return a sized version of the column type, utilizing either (or neither) of
self.length
andself.nbytes
.toSqlAlchemy
(tableName, schema)Construct a SQLAlchemy
Column
object 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.length
andself.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
Column
object from this specification.
-