Fix Mysql bigint (#8665)

* Fix mysql bigint cast

* Remove upgrade from dockerfiles
This commit is contained in:
Pere Miquel Brull 2022-11-11 10:12:23 +01:00 committed by GitHub
parent 91d0460b27
commit ff028a6eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -57,8 +57,8 @@ USER airflow
# Argument to provide for Ingestion Dependencies to install. Defaults to all
ARG INGESTION_DEPENDENCY="all"
RUN pip install --upgrade pip
RUN pip install --upgrade openmetadata-managed-apis --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.3.3/constraints-3.9.txt"
RUN pip install --upgrade openmetadata-ingestion[${INGESTION_DEPENDENCY}]
RUN pip install "openmetadata-managed-apis==0.12.2.4" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.3.3/constraints-3.9.txt"
RUN pip install "openmetadata-ingestion[${INGESTION_DEPENDENCY}]==0.12.2.4"
# Uninstalling psycopg2-binary and installing psycopg2 instead
# because the psycopg2-binary generates a architecture specific error
# while authrenticating connection with the airflow, psycopg2 solves this error

View File

@ -67,7 +67,7 @@ RUN pip install "."
WORKDIR /home/airflow/ingestion
ARG INGESTION_DEPENDENCY="all"
RUN pip install --upgrade ".[${INGESTION_DEPENDENCY}]"
RUN pip install ".[${INGESTION_DEPENDENCY}]"
# Uninstalling psycopg2-binary and installing psycopg2 instead
# because the psycopg2-binary generates a architecture specific error

View File

@ -43,6 +43,15 @@ def _(element, compiler, **kw):
return f"SUM(CAST({proc} AS NUMERIC))"
@compiles(SumFn, Dialects.MySQL)
def _(element, compiler, **kw):
"""MySQL uses (UN)SIGNED INTEGER to cast to BIGINT
https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html
"""
proc = compiler.process(element.clauses, **kw)
return f"SUM(CAST({proc} AS UNSIGNED INTEGER))"
@compiles(SumFn, Dialects.Snowflake)
@compiles(SumFn, Dialects.Vertica)
def _(element, compiler, **kw):