Created
August 26, 2017 01:03
-
-
Save brianv0/719a719cded65475b0880a035366ef3d to your computer and use it in GitHub Desktop.
yaml model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Database(Schema): | |
class Meta: | |
ordered = True | |
name = fields.String() | |
id = fields.Integer() | |
tables = fields.Nested(Table, many=True) | |
class Table(Schema): | |
class Meta: | |
ordered = True | |
name = fields.String() | |
id = fields.Integer() | |
description = fields.String() | |
columns = fields.Nested(Column, many=True) | |
primary_key = fields.Nested(PrimaryKey) | |
indexes = fields.Nested(Index, many=True) | |
constraints = fields.Nested(Constraint, many=True) | |
foreign_keys = fields.Nested(DatabaseIndex, many=True) | |
class Column(Schema): | |
class Meta: | |
ordered = True | |
name = fields.String() | |
id = fields.Integer() | |
ordinal = fields.Integer() | |
datatype = fields.String() | |
nullable = fields.Boolean() | |
default = fields.String() | |
length = fields.Integer() | |
scale = fields.Integer() | |
precision = fields.Integer() | |
description = fields.String() | |
utype = fields.String() | |
ucd = fields.String() | |
unit = fields.String() | |
arraysize = fields.Integer() | |
class Constraint(Schema): | |
class Meta: | |
ordered = True | |
name = fields.String() # optional | |
type = fields.String() # (unique, primary, foreign, check) | |
columns = fields.List(fields.String()) | |
expression = fields.String() # if check constraint | |
refcolumns = fields.List(fields.String()) # if foreign key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment