MCPcopy
hub / github.com/dbcli/pgcli / function_definition

Method function_definition

pgcli/pgexecute.py:523–534  ·  view source on GitHub ↗

Returns the SQL defining functions described by `spec`

(self, spec)

Source from the content-addressed store, hash-verified

521 )
522
523 def function_definition(self, spec):
524 """Returns the SQL defining functions described by `spec`"""
525
526 with self.conn.cursor() as cur:
527 sql = self.function_definition_query
528 _logger.debug("Function Definition Query. sql: %r\nspec: %r", sql, spec)
529 try:
530 cur.execute(sql, (spec,))
531 result = cur.fetchone()
532 return result[0]
533 except psycopg.ProgrammingError:
534 raise RuntimeError(f"Function {spec} does not exist.")
535
536 def schemata(self):
537 """Returns a list of schema names in the database"""

Callers 3

handle_editor_commandMethod · 0.80
test_function_definitionFunction · 0.80

Calls 2

fetchoneMethod · 0.80
executeMethod · 0.45

Tested by 2

test_function_definitionFunction · 0.64