本文整理汇总了Python中sqlalchemy.dialects.postgresql.INET属性的典型用法代码示例。如果您正苦于以下问题:Python postgresql.INET属性的具体用法?Python postgresql.INET怎么用?Python postgresql.INET使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sqlalchemy.dialects.postgresql
的用法示例。
在下文中一共展示了postgresql.INET属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import INET [as 别名]
def upgrade():
op.create_table(
'config',
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('name', sa.String, nullable=False),
sa.Column('listen', INET, nullable=False),
sa.Column('port', sa.Integer, nullable=False),
sa.Column('webport', sa.Integer, nullable=False),
sa.Column('apitoken', sa.String, nullable=False),
sa.Column('freqband', sa.String, nullable=False),
sa.Column('netid', sa.Integer, nullable=False),
sa.Column('duplicateperiod', sa.Integer, nullable=False),
sa.Column('fcrelaxed', sa.Boolean, nullable=False),
sa.Column('otaastart', sa.Integer, nullable=False),
sa.Column('otaaend', sa.Integer, nullable=False),
sa.Column('macqueueing', sa.Boolean, nullable=False),
sa.Column('macqueuelimit', sa.Integer, nullable=False),
sa.Column('adrenable', sa.Boolean, nullable=False),
sa.Column('adrmargin', sa.Float, nullable=False),
sa.Column('adrcycletime', sa.Integer, nullable=False),
sa.Column('adrmessagetime', sa.Integer, nullable=False),
sa.Column('created', sa.DateTime(timezone=True), nullable=False),
sa.Column('updated', sa.DateTime(timezone=True), nullable=False),
)
示例2: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import INET [as 别名]
def upgrade():
op.create_table(
'gateways',
sa.Column('id', sa.Integer, primary_key=True, autoincrement=True),
sa.Column('host', INET, nullable=False, unique=True),
sa.Column('name', sa.String, nullable=True),
sa.Column('enabled', sa.Boolean, nullable=False, default=True),
sa.Column('eui', sa.Numeric, nullable=False, unique=True),
sa.Column('power', sa.Integer, nullable=False),
sa.Column('port', sa.String, nullable=True),
sa.Column('latitude', sa.Float, nullable=True),
sa.Column('longitude', sa.Float, nullable=True),
sa.Column('created', sa.DateTime(timezone=True), nullable=False),
sa.Column('updated', sa.DateTime(timezone=True), nullable=False),
)
op.add_column('devices',
sa.Column('devnonce', sa.dialects.postgresql.ARRAY(sa.Integer())))
示例3: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import INET [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('ip_address',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('authorising_user_id', sa.Integer(), nullable=True),
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('_ip', postgresql.INET(), nullable=True),
sa.Column('country', sa.String(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
示例4: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import INET [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('node', sa.Column('is_active', sa.Boolean(), server_default='1', nullable=False))
op.add_column('node', sa.Column('last_ip', postgresql.INET(), nullable=True))
### end Alembic commands ###
示例5: test_inet
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import INET [as 别名]
def test_inet(self):
self._test('inet', INET)
示例6: special_types_table
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import INET [as 别名]
def special_types_table(self, metadata):
# create these types so that we can issue
# special SQL92 INTERVAL syntax
class y2m(types.UserDefinedType, postgresql.INTERVAL):
def get_col_spec(self):
return "INTERVAL YEAR TO MONTH"
class d2s(types.UserDefinedType, postgresql.INTERVAL):
def get_col_spec(self):
return "INTERVAL DAY TO SECOND"
table = Table(
"sometable",
metadata,
Column("id", postgresql.UUID, primary_key=True),
Column("flag", postgresql.BIT),
Column("bitstring", postgresql.BIT(4)),
Column("addr", postgresql.INET),
Column("addr2", postgresql.MACADDR),
Column("price", postgresql.MONEY),
Column("addr3", postgresql.CIDR),
Column("doubleprec", postgresql.DOUBLE_PRECISION),
Column("plain_interval", postgresql.INTERVAL),
Column("year_interval", y2m()),
Column("month_interval", d2s()),
Column("precision_interval", postgresql.INTERVAL(precision=3)),
Column("tsvector_document", postgresql.TSVECTOR),
)
return table