Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

fix/Platform Seelct Query Fix (#368)

Athul8f0578154b70
diff --git a/platform-service/src/unstract/platform_service/main.py b/platform-service/src/unstract/platform_service/main.py
index de9591d00..0ec994776 100644
--- a/platform-service/src/unstract/platform_service/main.py
+++ b/platform-service/src/unstract/platform_service/main.py
@@ -90,17 +90,15 @@ def authentication_middleware(func: Any) -> Any:
def get_account_from_bearer_token(token: Optional[str]) -> str:
- query = "SELECT organization_id FROM account_platformkey " f"WHERE key='{token}'"
- organization = execute_query(query)
- query_org = (
- "SELECT schema_name FROM account_organization " f"WHERE id='{organization}'"
- )
- schema_name: str = execute_query(query_org)
+ query = "SELECT organization_id FROM account_platformkey WHERE key=%s"
+ organization = execute_query(query, (token,))
+ query_org = "SELECT schema_name FROM account_organization WHERE id=%s"
+ schema_name: str = execute_query(query_org, (organization,))
return schema_name
-def execute_query(query: str) -> Any:
- cursor = be_db.execute_sql(query)
+def execute_query(query: str, params: tuple = ()) -> Any:
+ cursor = be_db.execute_sql(query, params)
result_row = cursor.fetchone()
cursor.close()
if not result_row or len(result_row) == 0: