Skip to content

Commit

Permalink
Some environment clean up and explicitly pass credentials to publish …
Browse files Browse the repository at this point in the history
…clients
  • Loading branch information
bendnorman committed Mar 6, 2024
1 parent 20db78a commit 4244376
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ POSTGRES_DB=postgres
POSTGRES_PORT=8880
JUPYTER_PORT=8890
PUDL_VERSION=v2024.2.6
GCP_PROJECT_ID=dbcp-dev-350818
GOOGLE_CLOUD_PROJECT=dbcp-dev-350818
GOOGLE_APPLICATION_CREDENTIALS=/app/gcloud_application_default_credentials.json
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ docs/_build/
# PyBuilder
target/

# DotEnv configuration
# .env
local.env

# Database
*.db
*.rdb
Expand Down
15 changes: 0 additions & 15 deletions default.env

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ beautifulsoup4~=4.11
plotly~=5.15.0
gridstatus~=0.20.0
s3fs>=2022.11.0
click
click>=8.1.7
6 changes: 4 additions & 2 deletions src/dbcp/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def upload_parquet_directory_to_gcs(
None
"""
# Create a storage client
client = storage.Client()
credentials, project_id = google.auth.default()
client = storage.Client(credentials=credentials, project=project_id)

# Get the GCS bucket
bucket = client.get_bucket(bucket_name)
Expand Down Expand Up @@ -58,7 +59,8 @@ def load_parquet_files_to_bigquery(
None
"""
# Create a BigQuery client
client = bigquery.Client()
credentials, project_id = google.auth.default()
client = bigquery.Client(credentials=credentials, project=project_id)

# Get the BigQuery dataset
dataset_id = f"test_{destination_blob_prefix}{'_version_outputs' if version == 'version-outputs' else ''}"
Expand Down

0 comments on commit 4244376

Please sign in to comment.