Here are the examples of the python api sqlalchemy_utils.CompositeType taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
3
Example 1
@pytest.fixture
def Account(self, Base):
class Account(Base):
__tablename__ = 'account'
id = sa.Column(sa.Integer, primary_key=True)
balance = sa.Column(
CompositeType(
'money_type',
[
sa.Column('currency', sa.String),
sa.Column('amount', sa.Integer)
]
)
)
return Account
3
Example 2
@pytest.fixture
def Account(self, Base):
class Account(Base):
__tablename__ = 'account'
id = sa.Column(sa.Integer, primary_key=True)
balance = sa.Column(
CompositeType(
'money_type',
[
sa.Column('currency', CurrencyType),
sa.Column('amount', sa.Integer)
]
)
)
return Account
3
Example 3
@pytest.fixture
def type_(self):
return CompositeType(
'money_type',
[
sa.Column('currency', CurrencyType),
sa.Column('amount', sa.Integer)
]
)
3
Example 4
@pytest.fixture
def type_(self):
return CompositeType(
'category',
[
sa.Column('scale', NumericRangeType),
sa.Column('name', sa.String)
]
)
3
Example 5
@pytest.fixture
def Account(self, Base):
pg_composite.registered_composites = {}
type_ = CompositeType(
'money_type',
[
sa.Column('currency', sa.String),
sa.Column('amount', sa.Integer)
]
)
class Account(Base):
__tablename__ = 'account'
id = sa.Column(sa.Integer, primary_key=True)
balance = sa.Column(type_)
return Account