MCPcopy Index your code
hub / github.com/dbcli/mycli / _emit_select_like

Function _emit_select_like

mycli/packages/completion_engine.py:246–274  ·  view source on GitHub ↗
(ctx: SuggestContext)

Source from the content-addressed store, hash-verified

244
245
246def _emit_select_like(ctx: SuggestContext) -> list[Suggestion]:
247 parent = _parent_name(ctx)
248 tables = _tables(ctx)
249 if parent:
250 tables = [t for t in tables if identifies(parent, *t)]
251 return [
252 {'type': 'column', 'tables': tables},
253 {'type': 'table', 'schema': parent},
254 {'type': 'view', 'schema': parent},
255 {'type': 'function', 'schema': parent},
256 ]
257 if is_inside_quotes(ctx.text_before_cursor, -1) == 'backtick':
258 # todo: this should be revised, since we complete too exuberantly within
259 # backticks, including keywords
260 aliases = _aliases(tables)
261 return [
262 {'type': 'column', 'tables': tables},
263 {'type': 'function', 'schema': []},
264 {'type': 'alias', 'aliases': aliases},
265 {'type': 'keyword'},
266 ]
267
268 aliases = _aliases(tables)
269 return [
270 {'type': 'column', 'tables': tables},
271 {'type': 'function', 'schema': []},
272 {'type': 'introducer'},
273 {'type': 'alias', 'aliases': aliases},
274 ]
275
276
277def _emit_relation_like(ctx: SuggestContext) -> list[Suggestion]:

Calls 5

_parent_nameFunction · 0.85
_tablesFunction · 0.85
identifiesFunction · 0.85
is_inside_quotesFunction · 0.85
_aliasesFunction · 0.85