• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python elements.quoted_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sqlalchemy.sql.elements.quoted_name函数的典型用法代码示例。如果您正苦于以下问题:Python quoted_name函数的具体用法?Python quoted_name怎么用?Python quoted_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了quoted_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: define_tables

 def define_tables(cls, metadata):
     Table(
         quoted_name('t1', quote=True), metadata,
         Column('id', Integer, primary_key=True),
     )
     Table(
         quoted_name('t2', quote=True), metadata,
         Column('id', Integer, primary_key=True),
         Column('t1id', ForeignKey('t1.id'))
     )
开发者ID:DanielPearl,项目名称:top_commodities,代码行数:10,代码来源:test_reflection.py


示例2: test_named_alias_disable_quote

    def test_named_alias_disable_quote(self):
        cte = select([literal(1).label("id")]).cte(
            name=quoted_name('CTE', quote=False))

        s1 = select([cte.c.id]).alias(
            name=quoted_name("DontQuote", quote=False))

        s = select([s1])
        self.assert_compile(
            s,
            'WITH CTE AS (SELECT :param_1 AS id) '
            'SELECT DontQuote.id FROM '
            '(SELECT CTE.id AS id FROM CTE) AS DontQuote'
        )
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:14,代码来源:test_cte.py


示例3: test_pickle_anon_label

 def test_pickle_anon_label(self):
     q1 = _anonymous_label(quoted_name("x", True))
     for loads, dumps in picklers():
         q2 = loads(dumps(q1))
         assert isinstance(q2, _anonymous_label)
         eq_(str(q1), str(q2))
         eq_(q1.quote, q2.quote)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:7,代码来源:test_quote.py


示例4: view

def view(name, metadata, selectable):
    if metadata.schema:
        full_name = metadata.schema + "." + name
    else:
        full_name = name
    t = table(quoted_name(name, None))
    t.metadata = metadata
    t.fullname = full_name
    t.schema = quoted_name(metadata.schema, None)

    for c in selectable.c:
        c._make_proxy(t)

    CreateView(t, selectable).execute_at('after-create', metadata)
    DropView(t).execute_at('before-drop', metadata)
    return t
开发者ID:mediatum,项目名称:mediatum,代码行数:16,代码来源:alchemyext.py


示例5: test_reflect_lowercase_forced_tables

    def test_reflect_lowercase_forced_tables(self):

        m2 = MetaData(testing.db)
        t2_ref = Table(quoted_name('t2', quote=True), m2, autoload=True)
        t1_ref = m2.tables['t1']
        assert t2_ref.c.t1id.references(t1_ref.c.id)

        m3 = MetaData(testing.db)
        m3.reflect(only=lambda name, m: name.lower() in ('t1', 't2'))
        assert m3.tables['t2'].c.t1id.references(m3.tables['t1'].c.id)
开发者ID:DanielPearl,项目名称:top_commodities,代码行数:10,代码来源:test_reflection.py


示例6: normalize_name

 def normalize_name(self, name):
     if name is None:
         return None
     if name.upper() == name and not \
             self.identifier_preparer._requires_quotes(name.lower()):
         return name.lower()
     elif name.lower() == name:
         return quoted_name(name, quote=True)
     else:
         return name
开发者ID:snowflakedb,项目名称:snowflake-sqlalchemy,代码行数:10,代码来源:snowdialect.py


示例7: test_quoted_name_bindparam_ok

    def test_quoted_name_bindparam_ok(self):
        from sqlalchemy.sql.elements import quoted_name

        with testing.db.connect() as conn:
            eq_(
                conn.scalar(
                    select(
                        [cast(
                            literal(quoted_name("some_name", False)), String)]
                    )
                ),
                "some_name"
            )
开发者ID:cpcloud,项目名称:sqlalchemy,代码行数:13,代码来源:test_dialect.py


示例8: normalize_name

 def normalize_name(self, name):
     # Remove trailing spaces: FB uses a CHAR() type,
     # that is padded with spaces
     name = name and name.rstrip()
     if name is None:
         return None
     elif name.upper() == name and \
             not self.identifier_preparer._requires_quotes(name.lower()):
         return name.lower()
     elif name.lower() == name:
         return quoted_name(name, quote=True)
     else:
         return name
开发者ID:robin900,项目名称:sqlalchemy,代码行数:13,代码来源:base.py


示例9: check_db_version

    def check_db_version(self, db_version_info, session=None):
        """
        Checks the database version and prints an error message on database
        version mismatch.

        - On mismatching or on missing version a sys.exit(1) is called.
        - On missing DBVersion table, it returns False
        - On compatible DB version, it returns True

        Parameters:
            db_version_info (db_version.DBVersionInfo): required database
                version.
            session: an open database session or None. If session is None, a
                new session is created.
        """

        try:
            dispose_engine = False
            if session is None:
                engine = SQLServer.create_engine(self.get_connection_string())
                dispose_engine = True
                session = CreateSession(engine)
            else:
                engine = session.get_bind()

            if not engine.has_table(quoted_name(DBVersion.__tablename__,
                                                True)):
                LOG.debug("Missing DBVersion table!")
                return False

            version = session.query(DBVersion).first()
            if version is None:
                # Version is not populated yet
                LOG.error('No version information found in the database.')
                sys.exit(1)
            elif not db_version_info.is_compatible(version.major,
                                                   version.minor):
                LOG.error('Version mismatch. Expected database version: ' +
                          str(db_version_info))
                version_from_db = 'v' + str(version.major) + '.' + str(
                    version.minor)
                LOG.error('Version from the database is: ' + version_from_db)
                LOG.error('Please update your database.')
                sys.exit(1)

            LOG.debug("Database version is compatible.")
            return True
        finally:
            session.commit()
            if dispose_engine:
                engine.dispose()
开发者ID:gyorb,项目名称:codechecker,代码行数:51,代码来源:database_handler.py


示例10: normalize_name

    def normalize_name(self, name):
        """
        Converting EXASol case insensitive identifiers (upper case)
        to  SQLAlchemy case insensitive identifiers (lower case)
        """
        if name is None:
            return None

        if six.PY2:
            if isinstance(name, str):
                name = name.decode(self.encoding)

        if name.upper() == name and \
              not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        elif name.lower() == name:
            return quoted_name(name, quote=True)
        else:
            return name
开发者ID:blue-yonder,项目名称:sqlalchemy_exasol,代码行数:19,代码来源:base.py


示例11: test_coerce_quoted_switch

 def test_coerce_quoted_switch(self):
     q1 = quoted_name("x", False)
     q2 = quoted_name(q1, True)
     eq_(q2.quote, True)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:4,代码来源:test_quote.py


示例12: test_rconcat_quotefalse

 def test_rconcat_quotefalse(self):
     q1 = quoted_name("x", False)
     self._assert_not_quoted("y" + q1)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:3,代码来源:test_quote.py


示例13: test_rconcat_quotetrue

 def test_rconcat_quotetrue(self):
     q1 = quoted_name("x", True)
     self._assert_not_quoted("y" + q1)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:3,代码来源:test_quote.py


示例14: test_apply_map_plain

 def test_apply_map_plain(self):
     q1 = _anonymous_label(quoted_name("x%s", None))
     q2 = q1.apply_map(("bar"))
     eq_(q2, "xbar")
     self._assert_not_quoted(q2)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:5,代码来源:test_quote.py


示例15: test_pickle_quote

 def test_pickle_quote(self):
     q1 = quoted_name("x", True)
     for loads, dumps in picklers():
         q2 = loads(dumps(q1))
         eq_(str(q1), str(q2))
         eq_(q1.quote, q2.quote)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:6,代码来源:test_quote.py


示例16: test_apply_map_quoted

 def test_apply_map_quoted(self):
     q1 = _anonymous_label(quoted_name("x%s", True))
     q2 = q1.apply_map(("bar"))
     eq_(q2, "xbar")
     eq_(q2.quote, True)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:5,代码来源:test_quote.py


示例17: test_coerce_none

 def test_coerce_none(self):
     q1 = quoted_name(None, False)
     eq_(q1, None)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:3,代码来源:test_quote.py


示例18: test_coerce_quoted_retain

 def test_coerce_quoted_retain(self):
     q1 = quoted_name("x", False)
     q2 = quoted_name(q1, False)
     eq_(q2.quote, False)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:4,代码来源:test_quote.py


示例19: test_rconcat_quotenone

 def test_rconcat_quotenone(self):
     q1 = quoted_name("x", None)
     self._assert_not_quoted("y" + q1)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:3,代码来源:test_quote.py


示例20: test_rconcat_anon

 def test_rconcat_anon(self):
     q1 = _anonymous_label(quoted_name("x", True))
     assert isinstance(q1, _anonymous_label)
     value = "y" + q1
     assert isinstance(value, _anonymous_label)
     self._assert_quoted(value, True)
开发者ID:BY-jk,项目名称:sqlalchemy,代码行数:6,代码来源:test_quote.py



注:本文中的sqlalchemy.sql.elements.quoted_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python expression._select_iterables函数代码示例发布时间:2022-05-27
下一篇:
Python elements.and_函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap