gensaschema._schema module

Schema module generation

Schema module generation code.

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._schema.Schema(conn, tables, schemas, symbols, dbname=None, types=None)

Schema container

CVariables
_MODULE_TPLTemplate

Template for the module

IVariables
_dialectstr

Dialect name

_tablesTableCollection

Table collection

_schemasdict

Schema -> module mapping

_symbolsSymbols

Symbol table

_dbnamestr or None

DB identifier

__dict__ = mappingproxy({'__module__': 'gensaschema._schema', '__doc__': '\n Schema container\n\n :CVariables:\n `_MODULE_TPL` : ``Template``\n Template for the module\n\n :IVariables:\n `_dialect` : ``str``\n Dialect name\n\n `_tables` : `TableCollection`\n Table collection\n\n `_schemas` : ``dict``\n Schema -> module mapping\n\n `_symbols` : `Symbols`\n Symbol table\n\n `_dbname` : ``str`` or ``None``\n DB identifier\n ', '_MODULE_TPL': <gensaschema._template.Template object>, '__init__': <function Schema.__init__>, 'dump': <function Schema.dump>, '__dict__': <attribute '__dict__' of 'Schema' objects>, '__weakref__': <attribute '__weakref__' of 'Schema' objects>})
__init__(conn, tables, schemas, symbols, dbname=None, types=None)

Initialization

Parameters
connConnection or Engine

SQLAlchemy connection or engine

tableslist

List of tables to reflect, (local name, table name) pairs

schemasdict

schema -> module mapping

symbolsSymbols

Symbol table

dbnamestr

Optional db identifier. Used for informational purposes. If omitted or None, the information just won’t be emitted.

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.

__module__ = 'gensaschema._schema'
__weakref__

list of weak references to the object (if defined)

dump(fp)

Dump schema module to fp

Parameters
fpfile

File to write to