gensaschema._constraint module¶
Constraint inspection and representation¶
Constraint 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._constraint.Constraint(constraint, table, symbols, options=None)[source]¶
Reflected Constraint
- constraint¶
Constraint
- Type:
SA Constraint
- _IMPORT = None¶
- _SYMBOL = None¶
- __dict__ = mappingproxy({'__module__': 'gensaschema._constraint', '__doc__': '\n Reflected Constraint\n\n Attributes:\n constraint (SA Constraint):\n Constraint\n ', '_SYMBOL': None, '_IMPORT': None, '__new__': <staticmethod(<function Constraint.__new__>)>, '__init__': <function Constraint.__init__>, 'copy': <function Constraint.copy>, '__cmp__': <function Constraint.__cmp__>, '__lt__': <function Constraint.__lt__>, 'repr': <function Constraint.repr>, '__dict__': <attribute '__dict__' of 'Constraint' objects>, '__weakref__': <attribute '__weakref__' of 'Constraint' objects>, '__annotations__': {}})¶
- __init__(constraint, table, symbols, options=None)[source]¶
Initialization
- Parameters:
constraint (
SA Constraint
) – Constrainttable (
str
) – Table varnamesymbols (gensaschema.Symbols) – Symbol table
options (
str
) – Options
- __module__ = 'gensaschema._constraint'¶
- __weakref__¶
list of weak references to the object (if defined)
- repr(symbol, args, keywords=(), short=False)[source]¶
Base repr for all constraints
- Parameters:
symbol (
str
) – Symbol nameargs (
iterable
) – Positional argumentskeywords (
iterable
) – Keywords arguments to specifyshort (
bool
) – Short representation (i.e. one-line)? Only applied if there are not too many parameters.
- Returns:
The constraint repr
- Return type:
str
- class gensaschema._constraint.ForeignKeyConstraint(constraint, table, symbols, options=None)[source]¶
ForeignKey constraint
- _IMPORT = 'from %(constraints)s import ForeignKey as %(fk)s'¶
- _SYMBOL = 'fk'¶
- __annotations__ = {}¶
- __module__ = 'gensaschema._constraint'¶
- class gensaschema._constraint.PrimaryKeyConstraint(constraint, table, symbols, options=None)[source]¶
Primary Key constraint
- _IMPORT = 'from %(constraints)s import PrimaryKey as %(pk)s'¶
- _SYMBOL = 'pk'¶
- __annotations__ = {}¶
- __module__ = 'gensaschema._constraint'¶