Introspection API¶
- class django_spanner.introspection.DatabaseIntrospection(connection)[source]¶
A Spanner-specific version of Django introspection utilities.
- django_table_names(only_existing=False, include_views=True)¶
Return a list of all table names that have associated Django models and are in INSTALLED_APPS.
If only_existing is True, include only the tables in the database.
- get_field_type(data_type, description)[source]¶
A hook for a Spanner database to use the cursor description to match a Django field type to the database column.
- get_key_columns(cursor, table_name)[source]¶
Return a list of (column_name, referenced_table, referenced_column) for all key columns in the given table.
- get_relations(cursor, table_name)[source]¶
Return a dictionary of {field_name: (field_name_other_table, other_table)} representing all the relationships in the table.
- get_sequences(cursor, table_name, table_fields=())¶
Return a list of introspected sequences for table_name. Each sequence is a dict: {‘table’: <table_name>, ‘column’: <column_name>}. An optional ‘name’ key can be added if the backend supports named sequences.
- get_table_description(cursor, table_name)[source]¶
Return a description of the table with the DB-API cursor.description interface.
- get_table_list(cursor)[source]¶
Return a list of table and view names in the current database.
- Parameters
cursor (
Cursor
) – A reference to a Spanner Database cursor.- Return type
- Returns
A list of table and view names in the current database.
- identifier_converter(name)¶
Apply a conversion to the identifier for the purposes of comparison.
The default identifier converter is for case sensitive comparison.
- installed_models(tables)¶
Return a set of all models represented by the provided list of table names.
- sequence_list()¶
Return a list of information about all DB sequences for all models in all apps.
- table_names(cursor=None, include_views=False)¶
Return a list of names of all tables that exist in the database. Sort the returned table list by Python’s default sorting. Do NOT use the database’s ORDER BY here to avoid subtle differences in sorting order between databases.