Returns the SQL defining functions described by `spec`
(self, spec)
| 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""" |