MCPcopy Create free account
hub / github.com/brokermr810/QuantDinger / execute_sql

Function execute_sql

backend_api_python/app/utils/db_postgres.py:662–672  ·  view source on GitHub ↗

Execute SQL and return results (convenience function)

(sql: str, params: tuple = None)

Source from the content-addressed store, hash-verified

660
661
662def execute_sql(sql: str, params: tuple = None) -> List[Dict[str, Any]]:
663 """
664 Execute SQL and return results (convenience function)
665 """
666 with get_pg_connection() as conn:
667 cursor = conn.cursor()
668 cursor.execute(sql, params)
669 if sql.strip().upper().startswith('SELECT'):
670 return cursor.fetchall()
671 conn.commit()
672 return []
673
674
675def is_postgres_available() -> bool:

Callers

nothing calls this directly

Calls 5

get_pg_connectionFunction · 0.85
cursorMethod · 0.45
executeMethod · 0.45
fetchallMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected