Python sqlalchemy.dialects() Examples

The following are 2 code examples of sqlalchemy.dialects(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy , or try the search function .
Example #1
Source File: TS_CodeGen_Objects.py    From pyaf with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 
Example #2
Source File: test_codegen.py    From safrs with GNU General Public License v3.0 4 votes vote down vote up
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()))
)
"""
        )