本文整理匯總了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