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

Function _emit_relation_like

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

Source from the content-addressed store, hash-verified

275
276
277def _emit_relation_like(ctx: SuggestContext) -> list[Suggestion]:
278 schema = _parent_name(ctx)
279 is_join = bool(ctx.token_value and ctx.token_value.endswith('join') and isinstance(ctx.token, Token) and ctx.token.is_keyword)
280
281 # Suggest tables from either the currently-selected schema or the
282 # public schema if no schema has been specified
283 table_suggestion: Suggestion = {'type': 'table', 'schema': schema}
284 if is_join:
285 table_suggestion['join'] = True
286 suggest: list[Suggestion] = [table_suggestion]
287
288 if not schema:
289 # Suggest schemas
290 suggest.append({'type': 'database'})
291
292 # Only tables can be TRUNCATED, otherwise suggest views
293 if ctx.token_value != 'truncate':
294 suggest.append({'type': 'view', 'schema': schema})
295
296 return suggest
297
298
299def _emit_relation_name(ctx: SuggestContext) -> list[Suggestion]:

Calls 1

_parent_nameFunction · 0.85