本文整理汇总了Python中metadata.get_result函数的典型用法代码示例。如果您正苦于以下问题:Python get_result函数的具体用法?Python get_result怎么用?Python get_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_result函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_suggested_multiple_column_names
def test_suggested_multiple_column_names(completer):
result = get_result(
completer, 'SELECT id, from custom.products', len('SELECT id, ')
)
assert completions_to_set(result) == completions_to_set(testdata.columns_functions_and_keywords(
'products', 'custom'
))
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例2: test_all_schema_objects_with_aliases
def test_all_schema_objects_with_aliases(completer):
text = ('SELECT * FROM ')
result = get_result(completer, text)
assert completions_to_set(result) >= completions_to_set(
[table(x) for x in ('orders o', '"select" s', 'custom.shipments s')]
+ [function(x) for x in ('func2() f',)]
)
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例3: test_suggested_aliases_after_on_right_side
def test_suggested_aliases_after_on_right_side(completer, text):
position = len(
'SELECT u.name, o.id FROM users u JOIN orders o ON o.user_id = '
)
result = get_result(completer, text, position)
assert completions_to_set(result) == completions_to_set(
[alias('u'), alias('o')])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例4: test_user_function_name_completion_matches_anywhere
def test_user_function_name_completion_matches_anywhere(completer):
result = get_result(completer, 'SELECT om')
assert completions_to_set(result) == completions_to_set([
function('custom_fun()', -2),
function('_custom_fun()', -2),
function('custom_func1()', -2),
function('custom_func2()', -2)])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例5: test_suggested_join_conditions
def test_suggested_join_conditions(completer, text):
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set([
alias('users'),
alias('shipments'),
name_join('shipments.id = users.id'),
fk_join('shipments.user_id = users.id')])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例6: test_aliased_joins
def test_aliased_joins(completer, text):
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set(testdata.schemas() + aliased_rels + [
join('"Users" U ON U.userid = Users.id'),
join('users u ON u.id = Users.parentid'),
join('users u ON u.parentid = Users.id'),
])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例7: test_suggest_columns_from_aliased_set_returning_function
def test_suggest_columns_from_aliased_set_returning_function(completer):
result = get_result(
completer, 'select f. from set_returning_func() f', len('select f.')
)
assert completions_to_set(result) == completions_to_set(
testdata.columns('set_returning_func', typ='functions')
)
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例8: test_cased_joins
def test_cased_joins(completer, text):
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set([schema('PUBLIC')] + cased_rels + [
join('"Users" ON "Users".UserID = Users.ID'),
join('Users Users2 ON Users2.ID = Users.PARENTID'),
join('Users Users2 ON Users2.PARENTID = Users.ID'),
])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例9: test_join_functions_using_suggests_common_columns
def test_join_functions_using_suggests_common_columns(completer):
text = '''SELECT * FROM set_returning_func() f1
INNER JOIN set_returning_func() f2 USING ('''
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set(
testdata.columns('set_returning_func', typ='functions')
)
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例10: test_suggested_column_names_from_schema_qualifed_table
def test_suggested_column_names_from_schema_qualifed_table(completer):
result = get_result(
completer, 'SELECT from custom.products', len('SELECT ')
)
assert completions_to_set(result) == completions_to_set(testdata.columns_functions_and_keywords(
'products', 'custom'
))
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例11: test_suggest_columns_from_set_returning_function
def test_suggest_columns_from_set_returning_function(completer):
result = get_result(
completer, 'select from set_returning_func()', len('select ')
)
assert completions_to_set(result) == completions_to_set(testdata.columns_functions_and_keywords(
'set_returning_func', typ='functions'
))
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例12: test_suggested_auto_qualified_column_names_two_tables
def test_suggested_auto_qualified_column_names_two_tables(text, completer):
position = text.index(' ') + 1
cols = [column('U.' + c.lower()) for c in cased_users_col_names]
cols += [column('"Users".' + c.lower()) for c in cased_users2_col_names]
result = get_result(completer, text, position)
assert completions_to_set(result) == completions_to_set(
cols + testdata.functions_and_keywords())
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py
示例13: test_all_schema_objects_with_casing
def test_all_schema_objects_with_casing(completer):
text = 'SELECT * FROM '
result = get_result(completer, text)
assert completions_to_set(result) >= completions_to_set(
[table(x) for x in ('Orders', '"select"', 'CUSTOM.shipments')]
+ [function(x + '()') for x in ('func2',)]
)
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例14: test_function_alias_search_with_aliases
def test_function_alias_search_with_aliases(completer):
text = 'SELECT blog.ee'
result = get_result(completer, text)
first = result[0]
assert first.start_position == -2
assert first.text == 'enter_entry(_title := , _text := )'
assert first.display_text == 'enter_entry(_title, _text)'
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例15: test_function_alias_search_without_aliases
def test_function_alias_search_without_aliases(completer):
text = 'SELECT blog.ees'
result = get_result(completer, text)
first = result[0]
assert first.start_position == -3
assert first.text == 'extract_entry_symbols()'
assert first.display_text == 'extract_entry_symbols(_entryid)'
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py
示例16: test_suggested_multiple_column_names_with_alias
def test_suggested_multiple_column_names_with_alias(completer):
result = get_result(
completer,
'SELECT p.id, p. from custom.products p',
len('SELECT u.id, u.')
)
assert completions_to_set(result) == completions_to_set(
testdata.columns('products', 'custom'))
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_smart_completion_multiple_schemata.py
示例17: test_suggested_aliases_after_on
def test_suggested_aliases_after_on(completer, text):
position = len('SELECT u.name, o.id FROM users u JOIN orders o ON ')
result = get_result(completer, text, position)
assert completions_to_set(result) == completions_to_set([
alias('u'),
name_join('o.id = u.id'),
name_join('o.email = u.email'),
alias('o')])
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_smart_completion_public_schema_only.py
示例18: test_table_aliases
def test_table_aliases(completer, text):
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set(testdata.schemas() + [
table('users u'),
table('orders o' if text == 'SELECT * FROM ' else 'orders o2'),
table('"select" s'),
function('func1() f'),
function('func2() f')])
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_smart_completion_multiple_schemata.py
示例19: test_set_schema
def test_set_schema(completer):
text = ('SET SCHEMA ')
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set([
schema(u"'blog'"),
schema(u"'Custom'"),
schema(u"'custom'"),
schema(u"'public'")])
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_smart_completion_multiple_schemata.py
示例20: test_table_casing
def test_table_casing(completer, text):
result = get_result(completer, text)
assert completions_to_set(result) == completions_to_set(cased_schemas + [
table('users'),
table('Orders'),
table('"select"'),
function('Func1()'),
function('func2()')])
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_smart_completion_multiple_schemata.py
注:本文中的metadata.get_result函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论