Ejemplo n.º 1
0
def test_where_suggests_columns_functions(expression):
    suggestions = suggest_type(expression, expression)
    assert suggestions == (Column(tables=[(None, 'tabl', None)],
                                  drop_unique=None),
                           Function(schema=None,
                                    filter=None), Alias(aliases=['tabl']),
                           Keyword(last_token='WHERE'))
Ejemplo n.º 2
0
def test_select_suggests_cols_with_qualified_table_scope():
    suggestions = suggest_type('SELECT  FROM sch.tabl', 'SELECT ')
    assert suggestions == (Column(tables=[('sch', 'tabl', None)],
                                  drop_unique=None),
                           Function(schema=None,
                                    filter=None), Alias(aliases=['tabl']),
                           Keyword(last_token='SELECT'))
Ejemplo n.º 3
0
def test_join_suggests_cols_with_qualified_table_scope():
    expression = 'SELECT * FROM tabl a JOIN tabl b on a.'
    suggestions = suggest_type(expression, expression)

    assert suggestions == (
        Column(tables=((None, 'tabl', 'a'),), drop_unique=None),
        Table(schema='a'),
        View(schema='a'),
        Function(schema='a', filter=None))
Ejemplo n.º 4
0
def test_u_suggests_databases():
    suggestions = suggest_type('\\u ', '\\u ')
    assert suggestions == (Database(), )
Ejemplo n.º 5
0
def test_list_or_show_create_tables():
    suggestions = suggest_type('\\dt+', '\\dt+ ')
    assert suggestions == (Table(schema=None), View(schema=None), Schema())
Ejemplo n.º 6
0
def test_describe_table():
    suggestions = suggest_type('\\dt', '\\dt ')
    assert suggestions == (Table(schema=None), View(schema=None), Schema())