Exemple #1
0
def cursor_for_schemas():

    result_set = [('public',),
                  ('schema2',),
                  ('schema3',),
                  ('schema4',)]

    cursor = MockCursor()
    cursor.mock_data(result_set)
    return cursor
Exemple #2
0
def cursor_for_tables():
    description = (Column(name='name'),
                   Column(name='oid'))

    result_set = [(10000, 'table1'),
                  (10001, 'table2'),
                  (10002, 'table3'),
                  (10003, 'table4'),
                  (10007, 'table5')]

    cursor = MockCursor()
    cursor.mock_data(result_set, description)
    return cursor
Exemple #3
0
def cursor_for_functions():
    description = (Column(name='name'),
                   Column(name='lang'),
                   Column(name='schema'),
                   Column(name='code'))

    result_set = [('function1', 'plpgsql', 'public', '...'),
                  ('function2', 'plpgsql', 'public', '...'),
                  ('function3', 'plpgsql', 'public', '...')]

    cursor = MockCursor()
    cursor.mock_data(result_set, description)
    return cursor
Exemple #4
0
def cursor_for_dependecies():
    description = (Column(name='fk_table_name'),
                   Column(name='referenced_table_name'))

    result_set = [('table1', 'table09'),
                  ('table2', 'table10'),
                  ('table3', 'table11'),
                  ('table4', 'table12'),
                  ('table7', 'table15'),
                  ('table8', 'table16')]

    cursor = MockCursor()
    cursor.mock_data(result_set, description)
    return cursor