gensaschema._type module

Type inspection and representation

Type inspection and representation.

Copyright:

Copyright 2010 - 2023 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._type.Type(ctype, dialect_name, symbols)[source]

Type container

_ctype

Column type

Type:

SA type

_dialect

Dialect name

Type:

str

_symbols

Symbol table

Type:

gensaschema.Symbols

__annotations__ = {}
__dict__ = mappingproxy({'__module__': 'gensaschema._type', '__doc__': '\n    Type container\n\n    Attributes:\n      _ctype (SA type):\n        Column type\n\n      _dialect (str):\n        Dialect name\n\n      _symbols (Symbols):\n        Symbol table\n    ', '__init__': <function Type.__init__>, 'by_column': <classmethod(<function Type.by_column>)>, '__repr__': <function Type.__repr__>, '__dict__': <attribute '__dict__' of 'Type' objects>, '__weakref__': <attribute '__weakref__' of 'Type' objects>, '__annotations__': {}})
__init__(ctype, dialect_name, symbols)[source]

Initialization

Parameters:
  • ctype (SA type) – Column type

  • dialect_name (str) – Dialect name

  • symbols (gensaschema.Symbols) – Symbol table

__module__ = 'gensaschema._type'
__repr__()[source]

Make string representation

Returns:

The string representation

Return type:

str

__weakref__

list of weak references to the object (if defined)

classmethod by_column(column, symbols)[source]

Construct by SA column

Parameters:

column (SA column) – SA column

Returns:

New Type instance

Return type:

Type

gensaschema._type._add_postgres_enum(ctype, symbols)[source]

Add postgres enum

gensaschema._type._finalize_type(ctype, dialect, symbols)[source]

Finalize type definitions and modifications

TODO:

should be generalized at some point in the future.

gensaschema._type._find_class(first_cls, name)[source]

Find class where a method is defined

Parameters:
  • first_cls (type) – Class to start with

  • name (str) – Method name

Returns:

class or None

Return type:

type