本文整理汇总了Python中sqlalchemy.dialects方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.dialects方法的具体用法?Python sqlalchemy.dialects怎么用?Python sqlalchemy.dialects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy
的用法示例。
在下文中一共展示了sqlalchemy.dialects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import dialects [as 别名]
def __init__(self, iDSN = None, iDialect = None):
self.mDebug = False;
print("CREATING_DATABASE_BACKEND_DSN_DIALECT", sqlalchemy.__version__, iDSN, iDialect);
self.mDSN = iDSN;
self.mDialectString = iDialect;
# firebird __init__.py mssql mysql oracle postgresql sqlite sybase
self.KNOWN_DIALECTS = {};
self.KNOWN_DIALECTS [ "firebird" ] = sqlalchemy.dialects.firebird.dialect()
self.KNOWN_DIALECTS [ "mssql" ] = sqlalchemy.dialects.mssql.dialect()
self.KNOWN_DIALECTS [ "mysql" ] = sqlalchemy.dialects.mysql.dialect()
self.KNOWN_DIALECTS [ "oracle" ] = sqlalchemy.dialects.oracle.dialect()
self.KNOWN_DIALECTS [ "postgresql" ] = sqlalchemy.dialects.postgresql.dialect()
self.KNOWN_DIALECTS [ "sqlite" ] = sqlalchemy.dialects.sqlite.dialect()
self.KNOWN_DIALECTS [ "sybase" ] = sqlalchemy.dialects.sybase.dialect()
self.mMeta = None;
self.mEngine = None;
self.mConnection = None;
self.mDialect = None;
self.initializeEngine();
self.mShortLabels = {};
pass
示例2: test_arrays
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import dialects [as 别名]
def test_arrays(metadata):
Table(
"simple_items",
metadata,
Column("dp_array", postgresql.ARRAY(postgresql.DOUBLE_PRECISION(precision=53))),
Column("int_array", postgresql.ARRAY(INTEGER)),
)
if sqlalchemy.__version__ < "1.1":
assert (
generate_code(metadata)
== """\
# coding: utf-8
from sqlalchemy import Column, Float, Integer, MetaData, Table
from sqlalchemy.dialects.postgresql.base import ARRAY
metadata = MetaData()
t_simple_items = Table(
'simple_items', metadata,
Column('dp_array', ARRAY(Float(precision=53))),
Column('int_array', ARRAY(Integer()))
)
"""
)
else:
assert (
generate_code(metadata)
== """\
# coding: utf-8
from sqlalchemy import ARRAY, Column, Float, Integer, MetaData, Table
metadata = MetaData()
t_simple_items = Table(
'simple_items', metadata,
Column('dp_array', ARRAY(Float(precision=53))),
Column('int_array', ARRAY(Integer()))
)
"""
)