Skip to content

Commit

Permalink
Single line creds, and code based creds
Browse files Browse the repository at this point in the history
  • Loading branch information
canimus committed Aug 25, 2023
1 parent aa9f2ea commit f2b1217
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ jobs:
- name: Generate coverage report
run: |
pip install '.[test,snowpark,pyspark,pandas,duckdb,bigquery,polars]'
echo "${{ secrets.GOOGLE_KEY }}" > creds.json
file creds.json
openssl dgst -sha256 creds.json
echo "SHA256(temp/key.json)= c3d51311e52f2a56c248648551fa57293d168641eee562a95f361a31a101f823"
coverage run -m pytest test/unit
coverage xml -o coverage.xml
env:
Expand Down
11 changes: 9 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,16 @@ def db() -> duckdb.DuckDBPyConnection:

@pytest.fixture(scope="session")
def bq_client():
#credentials = os.getenv('GOOGLE_APPLICATION_CREDENTIALS')
from google.oauth2 import service_account
import os
import json
with open("key.json", "w") as writer:
json.dump(json.loads(os.getenv("GOOGLE_KEY")), writer)

credentials = service_account.Credentials.from_service_account_file("key.json")

try:
client = bigquery.Client(project="cuallee-bigquery-386709")
client = bigquery.Client(project="cuallee-bigquery-386709", credentials=credentials)
return client
except:
pass
Expand Down

0 comments on commit f2b1217

Please sign in to comment.