Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/insert-into-connector-fix #405

Merged
merged 9 commits into from
Jun 20, 2024
6 changes: 0 additions & 6 deletions backend/workflow_manager/endpoint/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,3 @@ class BigQuery:
"""

TABLE_NAME_SIZE = 3
COLUMN_TYPES = [
"DATE",
"DATETIME",
"TIME",
"TIMESTAMP",
]
7 changes: 0 additions & 7 deletions backend/workflow_manager/endpoint/database_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ def get_sql_values_for_query(
sql_values[column] = f"parse_json($${values[column]}$$)"
else:
sql_values[column] = f"{values[column]}"
elif cls_name == DBConnectionClass.BIGQUERY:
col = column.lower()
type_x = column_types[col]
if type_x in BigQuery.COLUMN_TYPES:
sql_values[column] = f"{type_x}({values[column]})"
else:
sql_values[column] = f"{values[column]}"
else:
# Default to Other SQL DBs
# TODO: Handle numeric types with no quotes
Expand Down
2 changes: 1 addition & 1 deletion backend/workflow_manager/endpoint/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from backend.celery import app as celery_app
from backend.celery_service import app as celery_app # type: ignore

__all__ = ["celery_app"]
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ def execute_query(
table_name = str(kwargs.get("table_name"))
try:
if sql_values:
engine.query(sql_query, job_config=sql_values)
query_job = engine.query(sql_query, job_config=sql_values)
else:
engine.query(sql_query)
query_job = engine.query(sql_query)
query_job.result()
except google.api_core.exceptions.Forbidden as e:
logger.error(f"Forbidden exception in creating/inserting data: {str(e)}")
raise BigQueryForbiddenException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def sql_to_db_mapping(value: str) -> str:
"""
python_type = type(value)
mapping = {
str: "SUPER",
str: "VARCHAR(65535)",
hari-kuriakose marked this conversation as resolved.
Show resolved Hide resolved
int: "BIGINT",
float: "DOUBLE PRECISION",
datetime.datetime: "TIMESTAMP",
}
return mapping.get(python_type, "SUPER")
return mapping.get(python_type, "VARCHAR(65535)")

@staticmethod
def get_create_table_query(table: str) -> str:
Expand Down
Loading