astro.sql.table
Module Contents
Classes
Contains additional information to access a SQL Table, which is very likely optional and, in some cases, may |
|
Withholds the information necessary to access a SQL Table. |
Attributes
- astro.sql.table.MAX_TABLE_NAME_LENGTH = 62
- astro.sql.table.TEMP_PREFIX = _tmp_
- class astro.sql.table.Metadata
Contains additional information to access a SQL Table, which is very likely optional and, in some cases, may be database-specific.
- schema :Optional[str]
- database :Optional[str]
- is_empty()
Check if all the fields are None.
- Return type
bool
- class astro.sql.table.Table
Withholds the information necessary to access a SQL Table. It is agnostic to the database type. If no name is given, it auto-generates a name for the Table and considers it temporary.
Temporary tables are prefixed with the prefix TEMP_PREFIX.
- template_fields = ['name']
- conn_id :str =
- name :str =
- Return type
str
- _name :str
- metadata :Metadata
- columns :List[sqlalchemy.Column]
- temp :bool = False
- __post_init__()
- Return type
None
- _create_unique_table_name(prefix='')
If a table is instantiated without a name, create a unique table for it. This new name should be compatible with all supported databases.
- Parameters
prefix (str) –
- Return type
str
- create_similar_table()
Create a new table with a unique name but with the same metadata.
- Return type
- property sqlalchemy_metadata
Return the Sqlalchemy metadata for the given table.
- Return type
sqlalchemy.MetaData
- property name
Return either the user-defined name or auto-generate one.
- Return type
str