FieldSpec¶
- class lsst.daf.butler.ddl.FieldSpec(name: str, dtype: type, length: int | None = None, nbytes: int | None = None, primaryKey: bool = False, autoincrement: bool = False, nullable: bool = True, default: Any = None, doc: str | None = None)¶
- Bases: - object- A data class for defining a column in a logical - Registrytable.- Attributes Summary - Whether the database should insert automatically incremented values when no value is provided in an INSERT. - A server-side default value for this field. - 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 - for_region([name, nullable, nbytes])- Create a - FieldSpecfor a spatial region column.- fromConfig(config, *args, **kwargs)- Return the Python type associated with this field's (SQL) dtype. - Return a sized version of the column type. - Indicate that this is a sqlalchemy.String field spec. - Attributes Documentation - autoincrement: bool = False¶
- Whether the database should insert automatically incremented values when no value is provided in an INSERT. 
 - default: Any = None¶
- A server-side default value for this field. - This is passed directly as the - server_defaultargument to- sqlalchemy.schema.Column. It does _not_ go through SQLAlchemy’s usual type conversion or quoting for Python literals, and should hence be used with care. See the SQLAlchemy documentation for more information.
 - nbytes: int | None = None¶
- Natural length used for hash and encoded-region columns, to be converted into the post-encoding length. 
 - nullable: bool = True¶
- Whether this field is allowed to be NULL. If - primaryKeyis- True, during construction this value will be forced to- False.
 - Methods Documentation - classmethod for_region(name: str = 'region', nullable: bool = True, nbytes: int = 2048) FieldSpec¶
- Create a - FieldSpecfor a spatial region column.- Parameters:
- Returns:
- specFieldSpec
- Specification structure for a region column. 
 
- spec
 
 - getPythonType() type¶
- Return the Python type associated with this field’s (SQL) dtype. - Returns:
- typetype
- Python type associated with this field’s (SQL) - dtype.
 
- type
 
 - getSizedColumnType() TypeEngine | type¶
- Return a sized version of the column type. - Utilizes either (or neither) of - self.lengthand- self.nbytes.- Returns:
- dtypesqlalchemy.types.TypeEngine
- A SQLAlchemy column type object. 
 
- dtype