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

Add a new database type: GaussDB #19392

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ buildNumber.properties

catalog-services/catalog-services.iml

gitpush.sh

# local docker volume
docker/development/docker-volume
docker-volume
Expand Down Expand Up @@ -54,6 +56,9 @@ logs
*.jar
*.war
*.ear
.files
yarn.lock
package.json

# mac dir files
.DS_Store
Expand Down Expand Up @@ -132,4 +137,4 @@ ingestion/tests/cli_e2e/**/*test.yaml
/ingestion/tests/integration/great_expectations/gx/*

# Tests
**/metastore_db/
**/metastore_db/
11 changes: 9 additions & 2 deletions docker/development/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# Build stage
FROM alpine:3 AS build

RUN sed -i 's|http://dl-cdn.alpinelinux.org|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories


COPY openmetadata-dist/target/openmetadata-*.tar.gz /

RUN mkdir -p /opt/openmetadata && \
Expand All @@ -24,9 +27,13 @@ FROM alpine:3
EXPOSE 8585

RUN adduser -D openmetadata && \
echo "https://mirrors.aliyun.com/alpine/v3.18/main" > /etc/apk/repositories && \
echo "https://mirrors.aliyun.com/alpine/v3.18/community" >> /etc/apk/repositories && \
rm -rf /var/cache/apk/* && \
apk update && \
apk upgrade && \
apk add --update --no-cache bash openjdk17-jre
apk add --no-cache bash openjdk17



COPY --chown=openmetadata:openmetadata --from=build /opt/openmetadata /opt/openmetadata
COPY --chmod=755 docker/openmetadata-start.sh /
Expand Down
6 changes: 6 additions & 0 deletions docker/docker-compose-quickstart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

# Build stage
FROM alpine:3 AS build




ARG RI_VERSION="1.6.0-SNAPSHOT"
ENV RELEASE_URL="https://github.com/open-metadata/OpenMetadata/releases/download/${RI_VERSION}-release/openmetadata-${RI_VERSION}.tar.gz"

Expand All @@ -21,6 +25,8 @@ RUN mkdir -p /opt/openmetadata && \

# Final stage
FROM alpine:3
RUN sed -i 's|http://dl-cdn.alpinelinux.org|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories

ARG RI_VERSION="1.6.0-SNAPSHOT"
ARG BUILD_DATE
ARG COMMIT_ID
Expand Down
1 change: 0 additions & 1 deletion docker/openmetadata.yaml

This file was deleted.

36 changes: 20 additions & 16 deletions docker/run_local_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,33 @@ debugOM="${debugOM:=false}"
authorizationToken="eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg"
cleanDbVolumes="${cleanDbVolumes:=true}"

echo "Running local docker using mode [$mode] database [$database] and skipping maven build [$skipMaven] with cleanDB as [$cleanDbVolumes]"
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') $*"
}

log "$LINENO: Running local docker using mode [$mode] database [$database] and skipping maven build [$skipMaven] with cleanDB as [$cleanDbVolumes]"

cd ../

echo "Stopping any previous Local Docker Containers"
log "$LINENO: Stopping any previous Local Docker Containers"
docker compose -f docker/development/docker-compose-postgres.yml down --remove-orphans
docker compose -f docker/development/docker-compose.yml down --remove-orphans

if [[ $skipMaven == "false" ]]; then
if [[ $mode == "no-ui" ]]; then
echo "Maven Build - Skipping Tests and UI"
log "$LINENO: Maven Build - Skipping Tests and UI"
mvn -DskipTests -DonlyBackend clean package -pl !openmetadata-ui
else
echo "Maven Build - Skipping Tests"
mvn -DskipTests clean package
log "$LINENO: Maven Build - Skipping Tests"
mvn -U -DskipTests clean package -X
fi
else
echo "Skipping Maven Build"
log "$LINENO: Skipping Maven Build"
fi

RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Failed to run Maven build!"
log "$LINENO: Failed to run Maven build!"
exit 1
fi

Expand All @@ -85,28 +89,29 @@ fi

if [[ $VIRTUAL_ENV == "" ]];
then
echo "Please Use Virtual Environment and make sure to generate Pydantic Models";
log "$LINENO: Please Use Virtual Environment and make sure to generate Pydantic Models";
else
echo "Generating Pydantic Models";
log "$LINENO: Generating Pydantic Models";
make install_dev generate
fi


echo "Starting Local Docker Containers"
echo "Using ingestion dependency: ${INGESTION_DEPENDENCY:-all}"
log "$LINENO: Starting Local Docker Containers"
log "$LINENO: Using ingestion dependency: ${INGESTION_DEPENDENCY:-all}"
log "$LINENO: database: ${database}"

if [[ $database == "postgresql" ]]; then
docker compose -f docker/development/docker-compose-postgres.yml build --build-arg INGESTION_DEPENDENCY="${INGESTION_DEPENDENCY:-all}" && docker compose -f docker/development/docker-compose-postgres.yml up -d
elif [[ $database == "mysql" ]]; then
docker compose -f docker/development/docker-compose.yml build --build-arg INGESTION_DEPENDENCY="${INGESTION_DEPENDENCY:-all}" && docker compose -f docker/development/docker-compose.yml up -d
else
echo "Invalid database type: $database"
log "$LINENO: Invalid database type: $database"
exit 1
fi

RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Failed to start Docker instances!"
log "$LINENO: Failed to start Docker instances!"
exit 1
fi

Expand Down Expand Up @@ -167,12 +172,11 @@ curl --location --request PATCH 'localhost:8080/api/v1/dags/sample_lineage' \
"is_paused": false
}'

echo "✔running reindexing"
log "$LINENO: ✔running reindexing"
# Trigger ElasticSearch ReIndexing from UI
curl --location --request POST 'http://localhost:8585/api/v1/apps/trigger/SearchIndexingApplication' \
--header 'Authorization: Bearer eyJraWQiOiJHYjM4OWEtOWY3Ni1nZGpzLWE5MmotMDI0MmJrOTQzNTYiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImlzQm90IjpmYWxzZSwiaXNzIjoib3Blbi1tZXRhZGF0YS5vcmciLCJpYXQiOjE2NjM5Mzg0NjIsImVtYWlsIjoiYWRtaW5Ab3Blbm1ldGFkYXRhLm9yZyJ9.tS8um_5DKu7HgzGBzS1VTA5uUjKWOCU0B_j08WXBiEC0mr0zNREkqVfwFDD-d24HlNEbrqioLsBuFRiwIWKc1m_ZlVQbG7P36RUxhuv2vbSp80FKyNM-Tj93FDzq91jsyNmsQhyNv_fNr3TXfzzSPjHt8Go0FMMP66weoKMgW2PbXlhVKwEuXUHyakLLzewm9UMeQaEiRzhiTMU3UkLXcKbYEJJvfNFcLwSl9W8JCO_l0Yj3ud-qt_nQYEZwqW6u5nfdQllN133iikV4fM5QZsMCnm8Rq1mvLR0y9bmJiD7fwM1tmJ791TUWqmKaTnP49U493VanKpUAfzIiOiIbhg'

sleep 60 # Sleep for 60 seconds to make sure the elasticsearch reindexing from UI finishes
tput setaf 2
echo "✔ OpenMetadata is up and running"

log "$LINENO: ✔ OpenMetadata is up and running"
58 changes: 46 additions & 12 deletions ingestion/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,30 @@ RUN apt-get -qq update \
&& rm -rf /var/lib/apt/lists/*
COPY --from=mysql /usr/bin/mysqldump /usr/bin/mysqldump

RUN if [ $(uname -m) = "arm64" || $(uname -m) = "aarch64" ]; \
then \
wget -q https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip -O /oracle-instantclient.zip && \
unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
else \
wget -q https://download.oracle.com/otn_software/linux/instantclient/1917000/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip -O /oracle-instantclient.zip && \
unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
fi
# RUN if [ $(uname -m) = "arm64" || $(uname -m) = "aarch64" ]; \
# then \
# wget -q https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip -O /oracle-instantclient.zip && \
# unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
# else \
# wget -q https://download.oracle.com/otn_software/linux/instantclient/1917000/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip -O /oracle-instantclient.zip && \
# unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
# fi

# local
COPY ./.files/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip
COPY ./.files/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip


RUN if [ $(uname -m) = "arm64" ] || [ $(uname -m) = "aarch64" ]; then \
unzip -qq -d /instantclient -j /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip && rm -f /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip; \
else \
unzip -qq -d /instantclient -j /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip && rm -f /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip; \
fi

USER airflow
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip install --upgrade pip
USER root

ENV LD_LIBRARY_PATH=/instantclient

Expand Down Expand Up @@ -78,7 +94,10 @@ ENV PIP_NO_CACHE_DIR=1
ENV PIP_QUIET=1
ARG RI_VERSION="1.6.0.0.dev0"
RUN pip install --upgrade pip
RUN pip install "openmetadata-managed-apis~=${RI_VERSION}" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.9.1/constraints-3.10.txt"

COPY ./.files/constraints-3.10.txt /opt/
# RUN pip install "openmetadata-managed-apis~=${RI_VERSION}" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.9.1/constraints-3.10.txt"
RUN pip install "openmetadata-managed-apis~=${RI_VERSION}" --constraint "/opt/constraints-3.10.txt"
RUN pip install "openmetadata-ingestion[${INGESTION_DEPENDENCY}]~=${RI_VERSION}"

# Temporary workaround for https://github.com/open-metadata/OpenMetadata/issues/9593
Expand All @@ -90,11 +109,26 @@ RUN [ $(uname -m) = "x86_64" ] \
RUN pip install "python-daemon>=3.0.0"
# remove all airflow providers except for docker and cncf kubernetes
RUN pip freeze | grep "apache-airflow-providers" | grep --invert-match -E "docker|http|cncf|fab" | xargs pip uninstall -y
# Uninstalling psycopg2-binary and installing psycopg2 instead
# because the psycopg2-binary generates a architecture specific error
# Uninstalling psycopg2-binary and installing psycopg2 instead
# because the psycopg2-binary generates a architecture specific error
# while authenticating connection with the airflow, psycopg2 solves this error
RUN pip uninstall psycopg2-binary -y
RUN pip install psycopg2 mysqlclient==2.1.1
# RUN pip install psycopg2 mysqlclient==2.1.1
RUN pip install mysqlclient==2.1.1

COPY ./.files/GaussDB_driver.zip /home/airflow/GaussDB_driver.zip
RUN unzip -q /home/airflow/GaussDB_driver.zip -d /home/airflow/ && \
rm -rf /home/airflow/GaussDB_driver.zip && \
\cp /home/airflow/GaussDB_driver/Centralized/Hce2_arm_64/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz /home/airflow/ && \
tar -zxf /home/airflow/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz -C /home/airflow/ && \
rm -rf /home/airflow/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz && \
rm -rf /home/airflow/GaussDB_driver && \
\cp /home/airflow/psycopg2 $(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])') -r && \
chmod 755 $(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])')/psycopg2 -R

ENV PYTHONPATH="${PYTHONPATH}:$(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])')"
ENV LD_LIBRARY_PATH="/home/airflow/lib:$LD_LIBRARY_PATH"

# Make required folders for openmetadata-airflow-apis
RUN mkdir -p /opt/airflow/dag_generated_configs
# This is required as it's responsible to create airflow.cfg file
Expand Down
61 changes: 49 additions & 12 deletions ingestion/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,31 @@ RUN dpkg --configure -a \
&& rm -rf /var/lib/apt/lists/*
COPY --from=mysql /usr/bin/mysqldump /usr/bin/mysqldump

RUN if [ $(uname -m) = "arm64" || $(uname -m) = "aarch64" ]; \
then \
wget https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip -O /oracle-instantclient.zip && \
unzip -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
else \
wget https://download.oracle.com/otn_software/linux/instantclient/1917000/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip -O /oracle-instantclient.zip && \
unzip -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
fi
# RUN if [ $(uname -m) = "arm64" || $(uname -m) = "aarch64" ]; \
# then \
# wget https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip -O /oracle-instantclient.zip && \
# unzip -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
# else \
# wget https://download.oracle.com/otn_software/linux/instantclient/1917000/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip -O /oracle-instantclient.zip && \
# unzip -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
# fi

# local
COPY ./.files/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip
COPY ./.files/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip
COPY ./.files/GaussDB_driver.zip /root/GaussDB_driver.zip

RUN if [ $(uname -m) = "arm64" ] || [ $(uname -m) = "aarch64" ]; then \
unzip -qq -d /instantclient -j /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip && rm -f /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip; \
else \
unzip -qq -d /instantclient -j /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip && rm -f /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip; \
fi


USER airflow
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip install --upgrade pip
USER root

ENV LD_LIBRARY_PATH=/instantclient

Expand All @@ -73,7 +90,11 @@ COPY --chown=airflow:0 openmetadata-airflow-apis /home/airflow/openmetadata-airf
COPY --chown=airflow:0 ingestion/examples/airflow/dags /opt/airflow/dags

USER airflow
ARG AIRFLOW_CONSTRAINTS_LOCATION="https://raw.githubusercontent.com/apache/airflow/constraints-2.9.1/constraints-3.10.txt"


COPY ./.files/constraints-3.10.txt /opt/
ARG AIRFLOW_CONSTRAINTS_LOCATION="/opt/constraints-3.10.txt"
# ARG AIRFLOW_CONSTRAINTS_LOCATION="https://raw.githubusercontent.com/apache/airflow/constraints-2.9.1/constraints-3.10.txt"

# Disable pip cache dir
# https://pip.pypa.io/en/stable/topics/caching/#avoiding-caching
Expand All @@ -91,6 +112,7 @@ WORKDIR /home/airflow/ingestion
# Argument to provide for Ingestion Dependencies to install. Defaults to all
ARG INGESTION_DEPENDENCY="all"
RUN pip install ".[${INGESTION_DEPENDENCY}]"
# RUN pip install ".[${INGESTION_DEPENDENCY}]" -i https://pypi.tuna.tsinghua.edu.cn/simple

# Temporary workaround for https://github.com/open-metadata/OpenMetadata/issues/9593
RUN [ $(uname -m) = "x86_64" ] \
Expand All @@ -103,11 +125,26 @@ RUN pip install "python-daemon>=3.0.0"
# remove all airflow providers except for docker and cncf kubernetes
RUN pip freeze | grep "apache-airflow-providers" | grep --invert-match -E "docker|http|cncf|fab" | xargs pip uninstall -y

# Uninstalling psycopg2-binary and installing psycopg2 instead
# because the psycopg2-binary generates a architecture specific error
# Uninstalling psycopg2-binary and installing psycopg2 instead
# because the psycopg2-binary generates a architecture specific error
# while authenticating connection with the airflow, psycopg2 solves this error
RUN pip uninstall psycopg2-binary -y
RUN pip install psycopg2 mysqlclient==2.1.1
RUN pip install mysqlclient==2.1.1

# install gaussdb driver
COPY ./.files/GaussDB_driver.zip /home/airflow/GaussDB_driver.zip
RUN unzip -q /home/airflow/GaussDB_driver.zip -d /home/airflow/ && \
rm -rf /home/airflow/GaussDB_driver.zip && \
\cp /home/airflow/GaussDB_driver/Centralized/Hce2_arm_64/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz /home/airflow/ && \
tar -zxf /home/airflow/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz -C /home/airflow/ && \
rm -rf /home/airflow/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz && \
rm -rf /home/airflow/GaussDB_driver && \
\cp /home/airflow/psycopg2 $(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])') -r && \
chmod 755 $(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])')/psycopg2 -R

ENV PYTHONPATH="${PYTHONPATH}:$(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])')"
ENV LD_LIBRARY_PATH="/home/airflow/lib:$LD_LIBRARY_PATH"

# Make required folders for openmetadata-airflow-apis
RUN mkdir -p /opt/airflow/dag_generated_configs

Expand Down
48 changes: 39 additions & 9 deletions ingestion/operators/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,30 @@ RUN echo "deb https://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" > /e
apt-get -qq autoremove -yqq --purge; \
apt-get -qq clean && rm -rf /var/lib/apt/lists/*

RUN if [ $(uname -m) = "arm64" || $(uname -m) = "aarch64" ]; \
then \
wget -q https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip -O /oracle-instantclient.zip && \
unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
else \
wget -q https://download.oracle.com/otn_software/linux/instantclient/1917000/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip -O /oracle-instantclient.zip && \
unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
fi
# RUN if [ $(uname -m) = "arm64" || $(uname -m) = "aarch64" ]; \
# then \
# wget -q https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip -O /oracle-instantclient.zip && \
# unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
# else \
# wget -q https://download.oracle.com/otn_software/linux/instantclient/1917000/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip -O /oracle-instantclient.zip && \
# unzip -qq -d /instantclient -j /oracle-instantclient.zip && rm -f /oracle-instantclient.zip; \
# fi

# local
COPY ./.files/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip
COPY ./.files/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip

RUN if [ $(uname -m) = "arm64" ] || [ $(uname -m) = "aarch64" ]; then \
unzip -qq -d /instantclient -j /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip && rm -f /root/instantclient-basic-linux.arm64-19.10.0.0.0dbru.zip; \
else \
unzip -qq -d /instantclient -j /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip && rm -f /root/instantclient-basic-linux.x64-19.17.0.0.0dbru.zip; \
fi


USER airflow
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip install --upgrade pip
USER root

ENV LD_LIBRARY_PATH=/instantclient

Expand Down Expand Up @@ -96,4 +112,18 @@ RUN [ $(uname -m) = "x86_64" ] \
# because the psycopg2-binary generates a architecture specific error
# while authenticating connection with the airflow, psycopg2 solves this error
RUN pip uninstall psycopg2-binary -y
RUN pip install psycopg2 mysqlclient==2.1.1
RUN pip install mysqlclient==2.1.1

# install gaussdb driver
COPY ./.files/GaussDB_driver.zip /home/airflow/GaussDB_driver.zip
RUN unzip -q /home/airflow/GaussDB_driver.zip -d /home/airflow/ && \
rm -rf /home/airflow/GaussDB_driver.zip && \
\cp /home/airflow/GaussDB_driver/Centralized/Hce2_arm_64/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz /home/airflow/ && \
tar -zxf /home/airflow/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz -C /home/airflow/ && \
rm -rf /home/airflow/GaussDB-Kernel_505.2.0_Hce_64bit_Python.tar.gz && \
rm -rf /home/airflow/GaussDB_driver && \
\cp /home/airflow/psycopg2 $(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])') -r && \
chmod 755 $(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])')/psycopg2 -R

ENV PYTHONPATH="${PYTHONPATH}:$(/home/airflow/.local/bin/python3 -c 'import site; print(site.getsitepackages()[0])')"
ENV LD_LIBRARY_PATH="/home/airflow/lib:$LD_LIBRARY_PATH"
Loading
Loading