How to use the pgcli.packages.sqlcompletion.Schema function in pgcli

To help you get started, we’ve selected a few pgcli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbcli / pgcli / tests / test_sqlcompletion.py View on Github external
def test_suggest_tables_views_schemas_and_functions(expression):
    suggestions = suggest_type(expression, expression)
    assert set(suggestions) == set([FromClauseItem(schema=None), Schema()])
github dbcli / pgcli / tests / test_sqlcompletion.py View on Github external
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(),
        ]
github dbcli / pgcli / tests / test_sqlcompletion.py View on Github external
def test_truncate_suggests_tables_and_schemas():
    suggestions = suggest_type("TRUNCATE ", "TRUNCATE ")
    assert set(suggestions) == set([Table(schema=None), Schema()])
github dbcli / pgcli / tests / test_sqlcompletion.py View on Github external
def test_2_statements_2nd_current():
    suggestions = suggest_type(
        "select * from a; select * from ", "select * from a; select * from "
    )
    assert set(suggestions) == set([FromClauseItem(schema=None), Schema()])

    suggestions = suggest_type(
        "select * from a; select  from b", "select * from a; select "
    )
    assert set(suggestions) == set(
        [
            Column(table_refs=((None, "b", None, False),), qualifiable=True),
            Function(schema=None),
            Keyword("SELECT"),
        ]
    )

    # Should work even if first statement is invalid
    suggestions = suggest_type(
        "select * from; select * from ", "select * from; select * from "
    )
github dbcli / pgcli / tests / test_sqlcompletion.py View on Github external
def test_sub_select_table_name_completion_with_outer_table(expression):
    suggestion = suggest_type(expression, expression)
    tbls = tuple([(None, "foo", None, False)])
    assert set(suggestion) == set(
        [FromClauseItem(schema=None, table_refs=tbls), Schema()]
    )