TapLoadingVisitor¶
- class felis.tap.TapLoadingVisitor(engine, catalog_name=None, schema_name=None, tap_tables=None, tap_schema_index=None)¶
Bases:
object
Generate TAP_SCHEMA data and insert it into a database using the SQLAlchemy ORM.
- Parameters:
catalog_name (
str
|None
, default:None
) – Name of the database catalog.schema_name (
str
|None
, default:None
) – Name of the schema.tap_tables (
MutableMapping
[str
,Any
] |None
, default:None
) – Mapping of TAP_SCHEMA table name to its SQLAlchemy table object.tap_schema_index (
int
|None
, default:None
) – The index of the schema for this TAP environment.
Methods Summary
check_column
(column_obj)Check consistency of VOTable attributes for a column.
from_mock_connection
(mock_connection[, ...])Create a TAP visitor from a mock connection.
visit_column
(column_obj, table_obj)Visit a column object and build its TAP_SCHEMA representation.
visit_constraint
(constraint_obj)Visit a constraint object and build its TAP_SCHEMA representation.
visit_constraints
(schema_obj)Visit all constraints in a schema.
visit_index
(index_obj, table_obj)Visit an index object and update the TAP_SCHEMA representation.
visit_primary_key
(primary_key_obj, table_obj)Visit a primary key object and update the TAP_SCHEMA representation.
visit_schema
(schema_obj)Visit a schema object and insert it into the TAP_SCHEMA database.
visit_table
(table_obj, schema_obj)Visit a table object and build its TAP_SCHEMA representation.
Methods Documentation
- check_column(column_obj)¶
Check consistency of VOTable attributes for a column.
Notes
This method checks that a column with a sized datatype has either a
votable:arraysize
or alength
attribute and issues a warning message if not. It also checks if a column with a timestamp datatype has aarraysize
attribute and issues a warning if not.
- classmethod from_mock_connection(mock_connection, catalog_name=None, schema_name=None, tap_tables=None, tap_schema_index=None)¶
Create a TAP visitor from a mock connection.
- Parameters:
mock_connection (
MockConnection
) – Mock connection object.catalog_name (
str
|None
, default:None
) – Name of the database catalog.schema_name (
str
|None
, default:None
) – Name of the database schema.tap_tables (
MutableMapping
[str
,Any
] |None
, default:None
) – Optional mapping of table name to its SQLAlchemy table object.tap_schema_index (
int
|None
, default:None
) – The index of the schema for this TAP environment.
- Returns:
The TAP loading visitor.
- Return type:
- visit_column(column_obj, table_obj)¶
Visit a column object and build its TAP_SCHEMA representation.
- visit_constraint(constraint_obj)¶
Visit a constraint object and build its TAP_SCHEMA representation.
- Parameters:
constraint_obj (
Constraint
) – The constraint object to visit.- Returns:
A tuple of the SQLAlchemy ORM objects for the TAP_SCHEMA
key
andkey_columns
data.- Return type:
- visit_constraints(schema_obj)¶
Visit all constraints in a schema.
- visit_index(index_obj, table_obj)¶
Visit an index object and update the TAP_SCHEMA representation.
- visit_primary_key(primary_key_obj, table_obj)¶
Visit a primary key object and update the TAP_SCHEMA representation.
- visit_schema(schema_obj)¶
Visit a schema object and insert it into the TAP_SCHEMA database.
- visit_table(table_obj, schema_obj)¶
Visit a table object and build its TAP_SCHEMA representation.