gensaschema._table module

Table inspection and representation

Table inspection and representation

Copyright

Copyright 2010 - 2019 André Malo or his licensors, as applicable

License

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class gensaschema._table.Table(varname, table, schemas, symbols)

Reflected table

CVariables
is_referencebool

Is it a table reference or a table?

IVariables
varnamestr

Variable name

sa_tablesqlalchemy.Table

Table

constraintslist

Constraint list

_symbolsSymbols

Symbol table

__dict__ = mappingproxy({'__module__': 'gensaschema._table', '__doc__': '\n Reflected table\n\n :CVariables:\n `is_reference` : ``bool``\n Is it a table reference or a table?\n\n :IVariables:\n `varname` : ``str``\n Variable name\n\n `sa_table` : ``sqlalchemy.Table``\n Table\n\n `constraints` : ``list``\n Constraint list\n\n `_symbols` : `Symbols`\n Symbol table\n ', 'is_reference': False, '__new__': <staticmethod object>, '__init__': <function Table.__init__>, 'by_name': <classmethod object>, '__repr__': <function Table.__repr__>, '__dict__': <attribute '__dict__' of 'Table' objects>, '__weakref__': <attribute '__weakref__' of 'Table' objects>})
__init__(varname, table, schemas, symbols)

Initialization

Parameters
varnamestr

Variable name

tablesqlalchemy.Table

Table

schemasdict

Schema -> module mapping

symbolsSymbols

Symbol table

__module__ = 'gensaschema._table'
static __new__(cls, varname, table, schemas, symbols)

Construct

This might actually return a table reference

Parameters
varnamestr

Variable name

tablesqlalchemy.Table

Table

schemasdict

Schema -> module mapping

symbolsSymbols

Symbol table

Return

Table or TableReference instance

Rtype

Table or TableReference

__repr__()

Make string representation

Return

The string representation

Rtype

str

__weakref__

list of weak references to the object (if defined)

classmethod by_name(name, varname, metadata, schemas, symbols, types=None)

Construct by name

Parameters
namestr

Table name (possibly qualified)

varnamestr

Variable name of the table

metadataSA (bound) metadata

Metadata container

schemasdict

Schema -> module mapping

symbolsSymbols

Symbol table

typescallable

Extra type loader. If the type reflection fails, because SQLAlchemy cannot resolve it, the type loader will be called with the type name, (bound) metadata and the symbol table. It is responsible for modifying the symbols and imports and the dialect’s ischema_names. If omitted or None, the reflector will always fail on unknown types.

Return

New Table instance

Rtype

Table

is_reference = False
class gensaschema._table.TableCollection

Table collection

__dict__ = mappingproxy({'__module__': 'gensaschema._table', '__doc__': ' Table collection ', 'by_names': <classmethod object>, '__dict__': <attribute '__dict__' of 'TableCollection' objects>})
__module__ = 'gensaschema._table'
classmethod by_names(metadata, names, schemas, symbols, types=None)

Construct by table names

Parameters
metadatasqlalchemy.MetaData

Metadata

namesiterable

Name list (list of tuples (varname, name))

symbolsSymbols

Symbol table

typescallable

Extra type loader. If the type reflection fails, because SQLAlchemy cannot resolve it, the type loader will be called with the type name, (bound) metadata and the symbol table. It is responsible for modifying the symbols and imports and the dialect’s ischema_names. If omitted or None, the reflector will always fail on unknown types.

Return

New table collection instance

Rtype

TableCollection

class gensaschema._table.TableReference(varname, table, schema, symbols)

Referenced table

__dict__ = mappingproxy({'__module__': 'gensaschema._table', '__doc__': ' Referenced table ', 'is_reference': True, '__init__': <function TableReference.__init__>, '__dict__': <attribute '__dict__' of 'TableReference' objects>, '__weakref__': <attribute '__weakref__' of 'TableReference' objects>})
__init__(varname, table, schema, symbols)

Initialization

Parameters
varnamestr

Variable name

tablesqlalchemy.Table

Table

symbolsSymbols

Symbol table

__module__ = 'gensaschema._table'
__weakref__

list of weak references to the object (if defined)

is_reference = True
gensaschema._table.logger = <Logger gensaschema._table (WARNING)>