當前位置: 首頁>>代碼示例>>Python>>正文


Python base.dialect方法代碼示例

本文整理匯總了Python中sqlalchemy.dialects.firebird.base.dialect方法的典型用法代碼示例。如果您正苦於以下問題:Python base.dialect方法的具體用法?Python base.dialect怎麽用?Python base.dialect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sqlalchemy.dialects.firebird.base的用法示例。


在下文中一共展示了base.dialect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_alias

# 需要導入模塊: from sqlalchemy.dialects.firebird import base [as 別名]
# 或者: from sqlalchemy.dialects.firebird.base import dialect [as 別名]
def test_alias(self):
        t = table("sometable", column("col1"), column("col2"))
        s = select([t.alias()])
        self.assert_compile(
            s,
            "SELECT sometable_1.col1, sometable_1.col2 "
            "FROM sometable AS sometable_1",
        )
        dialect = firebird.FBDialect()
        dialect._version_two = False
        self.assert_compile(
            s,
            "SELECT sometable_1.col1, sometable_1.col2 "
            "FROM sometable sometable_1",
            dialect=dialect,
        ) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:18,代碼來源:test_firebird.py

示例2: test_varchar_raise

# 需要導入模塊: from sqlalchemy.dialects.firebird import base [as 別名]
# 或者: from sqlalchemy.dialects.firebird.base import dialect [as 別名]
def test_varchar_raise(self):
        for type_ in (
            String,
            VARCHAR,
            String(),
            VARCHAR(),
            Unicode,
            Unicode(),
        ):
            type_ = sqltypes.to_instance(type_)
            assert_raises_message(
                exc.CompileError,
                "VARCHAR requires a length on dialect firebird",
                type_.compile,
                dialect=firebird.dialect(),
            )

            t1 = Table("sometable", MetaData(), Column("somecolumn", type_))
            assert_raises_message(
                exc.CompileError,
                r"\(in table 'sometable', column 'somecolumn'\)\: "
                r"(?:N)?VARCHAR requires a length on dialect firebird",
                schema.CreateTable(t1).compile,
                dialect=firebird.dialect(),
            ) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:27,代碼來源:test_firebird.py

示例3: test_column_computed_raises

# 需要導入模塊: from sqlalchemy.dialects.firebird import base [as 別名]
# 或者: from sqlalchemy.dialects.firebird.base import dialect [as 別名]
def test_column_computed_raises(self, persisted):
        m = MetaData()
        t = Table(
            "t",
            m,
            Column("x", Integer),
            Column("y", Integer, Computed("x + 2", persisted=persisted)),
        )
        assert_raises_message(
            exc.CompileError,
            "Firebird computed columns do not support a persistence method",
            schema.CreateTable(t).compile,
            dialect=firebird.dialect(),
        ) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:16,代碼來源:test_firebird.py

示例4: test_version_parsing

# 需要導入模塊: from sqlalchemy.dialects.firebird import base [as 別名]
# 或者: from sqlalchemy.dialects.firebird.base import dialect [as 別名]
def test_version_parsing(self):
        for string, result in [
            ("WI-V1.5.0.1234 Firebird 1.5", (1, 5, 1234, "firebird")),
            ("UI-V6.3.2.18118 Firebird 2.1", (2, 1, 18118, "firebird")),
            ("LI-V6.3.3.12981 Firebird 2.0", (2, 0, 12981, "firebird")),
            ("WI-V8.1.1.333", (8, 1, 1, "interbase")),
            ("WI-V8.1.1.333 Firebird 1.5", (1, 5, 333, "firebird")),
        ]:
            eq_(testing.db.dialect._parse_version_info(string), result) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:11,代碼來源:test_firebird.py

示例5: test_rowcount_flag

# 需要導入模塊: from sqlalchemy.dialects.firebird import base [as 別名]
# 或者: from sqlalchemy.dialects.firebird.base import dialect [as 別名]
def test_rowcount_flag(self):
        metadata = self.metadata
        engine = engines.testing_engine(options={"enable_rowcount": True})
        assert engine.dialect.supports_sane_rowcount
        metadata.bind = engine
        t = Table("t1", metadata, Column("data", String(10)))
        metadata.create_all()
        r = t.insert().execute({"data": "d1"}, {"data": "d2"}, {"data": "d3"})
        r = t.update().where(t.c.data == "d2").values(data="d3").execute()
        eq_(r.rowcount, 1)
        r = t.delete().where(t.c.data == "d3").execute()
        eq_(r.rowcount, 2)
        r = t.delete().execution_options(enable_rowcount=False).execute()
        eq_(r.rowcount, -1)
        engine.dispose()
        engine = engines.testing_engine(options={"enable_rowcount": False})
        assert not engine.dialect.supports_sane_rowcount
        metadata.bind = engine
        r = t.insert().execute({"data": "d1"}, {"data": "d2"}, {"data": "d3"})
        r = t.update().where(t.c.data == "d2").values(data="d3").execute()
        eq_(r.rowcount, -1)
        r = t.delete().where(t.c.data == "d3").execute()
        eq_(r.rowcount, -1)
        r = t.delete().execution_options(enable_rowcount=True).execute()
        eq_(r.rowcount, 1)
        r.close()
        engine.dispose() 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:29,代碼來源:test_firebird.py


注:本文中的sqlalchemy.dialects.firebird.base.dialect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。