コード例 #1
0
def test_suggest_qualified_tables_views_functions_and_joins(expression):
    suggestions = suggest_type(expression, expression)
    tbls = tuple([(None, 'foo', None, False)])
    assert set(suggestions) == set([
        FromClauseItem(schema='sch', table_refs=tbls),
        Join(tbls, 'sch'),
    ])
コード例 #2
0
def test_suggest_qualified_tables_views_functions_and_joins(expression):
    suggestions = suggest_type(expression, expression)
    tbls = tuple([(None, "foo", None, False)])
    assert set(suggestions) == {
        FromClauseItem(schema="sch", table_refs=tbls),
        Join(tbls, "sch"),
    }
コード例 #3
0
def test_suggest_after_join_with_one_table(expression):
    suggestions = suggest_type(expression, expression)
    tables = ((None, 'foo', None, False), )
    assert set(suggestions) == set([
        FromClauseItem(schema=None, table_refs=tables),
        Join(((None, 'foo', None, False), ), None),
        Schema(),
    ])
コード例 #4
0
def test_suggest_after_join_with_two_tables(expression):
    suggestions = suggest_type(expression, expression)
    tables = tuple([(None, 'foo', None, False), (None, 'bar', None, False)])
    assert set(suggestions) == set([
        FromClauseItem(schema=None, table_refs=tables),
        Join(tables, None),
        Schema(),
    ])
コード例 #5
0
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)
    tbls = tuple([(None, 'abc', tbl_alias or None, False)])
    assert set(suggestion) == set([
        FromClauseItem(schema=None, table_refs=tbls),
        Schema(),
        Join(tbls, None),
    ])
コード例 #6
0
def test_join_suggests_tables_and_schemas(tbl_alias, join_type):
    text = f"SELECT * FROM abc {tbl_alias} {join_type} JOIN "
    suggestion = suggest_type(text, text)
    tbls = tuple([(None, "abc", tbl_alias or None, False)])
    assert set(suggestion) == {
        FromClauseItem(schema=None, table_refs=tbls),
        Schema(),
        Join(tbls, None),
    }