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

Update cloud-sql-proxy.sh #1236

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions cloud-sql-proxy/cloud-sql-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ readonly METASTORE_INSTANCE
ADDITIONAL_INSTANCES="$(/usr/share/google/get_metadata_value ${ADDITIONAL_INSTANCES_KEY} || echo '')"
readonly ADDITIONAL_INSTANCES

POSTGRES_JDBC_VERSION="$(/usr/share/google/get_metadata_value attributes/postgres-jdbc-version || echo '42.7.4')"
readonly POSTGRES_JDBC_VERSION

function remove_old_backports {
# This script uses 'apt-get update' and is therefore potentially dependent on
# backports repositories which have been archived. In order to mitigate this
Expand Down Expand Up @@ -138,6 +141,15 @@ else
fi
readonly METASTORE_PROXY_PORT

# get postgres driver
if [[ "${CLOUDSQL_INSTANCE_TYPE}" == "POSTGRES" ]]; then
log 'Downloading JDBC driver for Postgres...'
wget -P /usr/share/java https://jdbc.postgresql.org/download/postgresql-"${POSTGRES_JDBC_VERSION}".jar
ln -s /usr/share/java/postgresql-"${POSTGRES_JDBC_VERSION}".jar /usr/share/java/postgresql-jdbc.jar
ln -s /usr/share/java/postgresql-jdbc.jar /usr/lib/hive/lib/postgresql-jdbc.jar
#wget https://jdbc.postgresql.org/download/postgresql-42.7.4.jar
fi

# Database user to use to access metastore.
DB_HIVE_USER="$(/usr/share/google/get_metadata_value attributes/db-hive-user || echo 'hive')"
readonly DB_HIVE_USER
Expand Down