当前位置: 首页>>代码示例>>Python>>正文


Python completion_engine.suggest_type函数代码示例

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


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


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