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

Python completion_engine.suggest_type函数代码示例

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

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



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

示例1: test_3_statements_2nd_current

def test_3_statements_2nd_current():
    suggestions = suggest_type('select * from a; select * from ; select * from c',
                               'select * from a; select * from ')
    assert sorted_dicts(suggestions) == sorted_dicts([
         {'type': 'table', 'schema': []},
         {'type': 'view', 'schema': []},
         {'type': 'schema'}])

    suggestions = suggest_type('select * from a; select  from b; select * from c',
                               'select * from a; select ')
    assert sorted_dicts(suggestions) == sorted_dicts([
            {'type': 'column', 'tables': [(None, 'b', None)]},
            {'type': 'function', 'schema': []}])
开发者ID:npk,项目名称:mycli,代码行数:13,代码来源:test_completion_engine.py


示例2: test_col_comma_suggests_cols

def test_col_comma_suggests_cols():
    suggestions = suggest_type('SELECT a, b, FROM tbl', 'SELECT a, b,')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'tbl', None)]},
        {'type': 'function', 'schema': []},
        {'type': 'keyword'},
        ])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例3: test_select_suggests_cols_with_visible_table_scope

def test_select_suggests_cols_with_visible_table_scope():
    suggestions = suggest_type('SELECT  FROM tabl', 'SELECT ')
    assert sorted_dicts(suggestions) == sorted_dicts([
            {'type': 'column', 'tables': [(None, 'tabl', None)]},
            {'type': 'function', 'schema': []},
            {'type': 'keyword'},
            ])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例4: test_join_alias_dot_suggests_cols2

def test_join_alias_dot_suggests_cols2(sql):
    suggestions = suggest_type(sql, sql)
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'def', 'd')]},
        {'type': 'table', 'schema': 'd'},
        {'type': 'view', 'schema': 'd'},
        {'type': 'function', 'schema': 'd'}])
开发者ID:Hsuing,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例5: test_table_comma_suggests_tables_and_schemas

def test_table_comma_suggests_tables_and_schemas():
    suggestions = suggest_type('SELECT a, b FROM tbl1, ',
            'SELECT a, b FROM tbl1, ')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'table', 'schema': []},
        {'type': 'view', 'schema': []},
        {'type': 'schema'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例6: test_dot_suggests_cols_of_a_table_or_schema_qualified_table

def test_dot_suggests_cols_of_a_table_or_schema_qualified_table():
    suggestions = suggest_type('SELECT tabl. FROM tabl', 'SELECT tabl.')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'tabl', None)]},
        {'type': 'table', 'schema': 'tabl'},
        {'type': 'view', 'schema': 'tabl'},
        {'type': 'function', 'schema': 'tabl'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例7: test_select_suggests_cols_and_funcs

def test_select_suggests_cols_and_funcs():
    suggestions = suggest_type('SELECT ', 'SELECT ')
    assert sorted_dicts(suggestions) == sorted_dicts([
         {'type': 'column', 'tables': []},
         {'type': 'function', 'schema': []},
         {'type': 'keyword'},
         ])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例8: test_where_in_suggests_columns

def test_where_in_suggests_columns(expression):
    suggestions = suggest_type(expression, expression)
    assert sorted_dicts(suggestions) == sorted_dicts([
            {'type': 'column', 'tables': [(None, 'tabl', None)]},
            {'type': 'function', 'schema': []},
            {'type': 'keyword'},
            ])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例9: test_join_suggests_tables_and_schemas

def test_join_suggests_tables_and_schemas(tbl_alias, join_type):
    text = 'SELECT * FROM abc {0} {1} JOIN '.format(tbl_alias, join_type)
    suggestion = suggest_type(text, text)
    assert sorted_dicts(suggestion) == sorted_dicts([
        {'type': 'table', 'schema': []},
        {'type': 'view', 'schema': []},
        {'type': 'schema'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例10: test_2_statements_1st_current

def test_2_statements_1st_current():
    suggestions = suggest_type('select * from ; select * from b',
                               'select * from ')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'table', 'schema': []},
        {'type': 'view', 'schema': []},
        {'type': 'schema'}])

    suggestions = suggest_type('select  from a; select * from b',
                               'select ')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'alias', 'aliases': ['a']},
        {'type': 'column', 'tables': [(None, 'a', None)]},
        {'type': 'function', 'schema': []},
        {'type': 'keyword'},
    ])
开发者ID:DaveXanderXU,项目名称:mycli,代码行数:16,代码来源:test_completion_engine.py


示例11: test_cross_join

def test_cross_join():
    text = 'select * from v1 cross join v2 JOIN v1.id, '
    suggestions = suggest_type(text, text)
    assert sorted_dicts(suggestions) == sorted_dicts([
         {'type': 'table', 'schema': []},
         {'type': 'view', 'schema': []},
         {'type': 'schema'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例12: test_where_equals_any_suggests_columns_or_keywords

def test_where_equals_any_suggests_columns_or_keywords():
    text = 'SELECT * FROM tabl WHERE foo = ANY('
    suggestions = suggest_type(text, text)
    assert sorted_dicts(suggestions) == sorted_dicts([
            {'type': 'column', 'tables': [(None, 'tabl', None)]},
            {'type': 'function', 'schema': []},
            {'type': 'keyword'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:7,代码来源:test_completion_engine.py


示例13: test_sub_select_dot_col_name_completion

def test_sub_select_dot_col_name_completion():
    suggestions = suggest_type('SELECT * FROM (SELECT t. FROM tabl t',
            'SELECT * FROM (SELECT t.')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'tabl', 't')]},
        {'type': 'table', 'schema': 't'},
        {'type': 'view', 'schema': 't'},
        {'type': 'function', 'schema': 't'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例14: test_sub_select_col_name_completion

def test_sub_select_col_name_completion():
    suggestions = suggest_type('SELECT * FROM (SELECT  FROM abc',
            'SELECT * FROM (SELECT ')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'abc', None)]},
        {'type': 'function', 'schema': []},
        {'type': 'keyword'},
        ])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例15: test_outer_table_reference_in_exists_subquery_suggests_columns

def test_outer_table_reference_in_exists_subquery_suggests_columns():
    q = 'SELECT * FROM foo f WHERE EXISTS (SELECT 1 FROM bar WHERE f.'
    suggestions = suggest_type(q, q)
    assert suggestions == [
        {'type': 'column', 'tables': [(None, 'foo', 'f')]},
        {'type': 'table', 'schema': 'f'},
        {'type': 'view', 'schema': 'f'},
        {'type': 'function', 'schema': 'f'}]
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例16: test_dot_col_comma_suggests_cols_or_schema_qualified_table

def test_dot_col_comma_suggests_cols_or_schema_qualified_table():
    suggestions = suggest_type('SELECT t1.a, t2. FROM tabl1 t1, tabl2 t2',
            'SELECT t1.a, t2.')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'tabl2', 't2')]},
        {'type': 'table', 'schema': 't2'},
        {'type': 'view', 'schema': 't2'},
        {'type': 'function', 'schema': 't2'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例17: test_partially_typed_col_name_suggests_col_names

def test_partially_typed_col_name_suggests_col_names():
    suggestions = suggest_type('SELECT * FROM tabl WHERE col_n',
            'SELECT * FROM tabl WHERE col_n')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'tabl', None)]},
        {'type': 'function', 'schema': []},
        {'type': 'keyword'},
        ])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例18: test_dot_suggests_cols_of_an_alias

def test_dot_suggests_cols_of_an_alias():
    suggestions = suggest_type('SELECT t1. FROM tabl1 t1, tabl2 t2',
            'SELECT t1.')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'table', 'schema': 't1'},
        {'type': 'view', 'schema': 't1'},
        {'type': 'column', 'tables': [(None, 'tabl1', 't1')]},
        {'type': 'function', 'schema': 't1'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例19: test_join_alias_dot_suggests_cols2

def test_join_alias_dot_suggests_cols2():
    suggestion = suggest_type('SELECT * FROM abc a JOIN def d ON a.',
            'SELECT * FROM abc a JOIN def d ON a.id = d.')
    assert sorted_dicts(suggestion) == sorted_dicts([
        {'type': 'column', 'tables': [(None, 'def', 'd')]},
        {'type': 'table', 'schema': 'd'},
        {'type': 'view', 'schema': 'd'},
        {'type': 'function', 'schema': 'd'}])
开发者ID:vasanthnathan,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py


示例20: test_select_suggests_cols_with_qualified_table_scope

def test_select_suggests_cols_with_qualified_table_scope():
    suggestions = suggest_type('SELECT  FROM sch.tabl', 'SELECT ')
    assert sorted_dicts(suggestions) == sorted_dicts([
        {'type': 'alias', 'aliases': ['tabl']},
        {'type': 'column', 'tables': [('sch', 'tabl', None)]},
        {'type': 'function', 'schema': []},
        {'type': 'keyword'},
    ])
开发者ID:DaveXanderXU,项目名称:mycli,代码行数:8,代码来源:test_completion_engine.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python Function.Function类代码示例发布时间:2022-05-27
下一篇:
Python MappingId.MappingId类代码示例发布时间: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