Esempio n. 1
0
 def test_on_suggests_aliases_right_side():
     sqls = [
         'select a.x, b.y from abc a join bcd b on a.id = ',
         'select a.x, b.y from abc a join bcd b on a.id = b.id AND a.id2 = ',
     ]
     for sql in sqls:
         suggestions = suggest_type(sql, sql)
         assert suggestions == (Alias(aliases=('a', 'b',)),)
Esempio n. 2
0
 def test_on_suggests_tables_and_join_conditions_right_side():
     sqls = [
         'select abc.x, bcd.y from abc join bcd on abc.id = bcd.id and ',
         'select abc.x, bcd.y from abc join bcd on ',
     ]
     for sql in sqls:
         suggestions = suggest_type(sql, sql)
         tables = ((None, 'abc', None, False), (None, 'bcd', None, False))
         assert set(suggestions) == set((JoinCondition(table_refs=tables, parent=None), \
             Alias(aliases=('abc', 'bcd',)),))
Esempio n. 3
0
def test_on_suggests_tables_and_join_conditions_right_side(sql):
    suggestions = suggest_type(sql, sql)
    tables = ((None, 'abc', None, False), (None, 'bcd', None, False))
    assert set(suggestions) == set((
        JoinCondition(table_refs=tables, parent=None),
        Alias(aliases=(
            'abc',
            'bcd',
        )),
    ))
Esempio n. 4
0
    def test_on_suggests_aliases_and_join_conditions():
        sqls = [ \
'select a.x, b.y from abc a join bcd b on ',
        '''select a.x, b.y
from abc a
join bcd b on
''',
        '''select a.x, b.y
from abc a
join bcd b
on ''',
        'select a.x, b.y from abc a join bcd b on a.id = b.id OR ' \
        ]
        for sql in sqls:
            suggestions = suggest_type(sql, sql)
            tables = ((None, 'abc', 'a', False), (None, 'bcd', 'b', False))
            assert set(suggestions) == set((JoinCondition(table_refs=tables, parent=None), \
                Alias(aliases=('a', 'b',)),))
Esempio n. 5
0
def test_on_suggests_aliases_right_side(sql):
    suggestions = suggest_type(sql, sql)
    assert suggestions == (Alias(aliases=(
        'a',
        'b',
    )), )