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

fix _set_config_variables is not defined #1729

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
18 changes: 16 additions & 2 deletions python-package/basedosdados/download/download.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions for managing downloads
"""

import gzip
import os
import re
Expand All @@ -26,6 +27,19 @@
from pydata_google_auth.exceptions import PyDataCredentialsError


def _set_config_variables(billing_project_id, from_file):
"""
Set billing_project_id and from_file variables
"""

# standard billing_project_id configuration
billing_project_id = billing_project_id or config.billing_project_id
# standard from_file configuration
from_file = from_file or config.from_file

return billing_project_id, from_file


def read_sql(
query,
billing_project_id=None,
Expand Down Expand Up @@ -67,9 +81,9 @@ def read_sql(

return read_gbq(
query,
project_id=config.billing_project_id,
project_id=billing_project_id,
use_bqstorage_api=use_bqstorage_api,
credentials=_credentials(from_file=config.from_file, reauth=reauth),
credentials=_credentials(from_file=from_file, reauth=reauth),
)
except GenericGBQException as e:
if "Reason: 403" in str(e):
Expand Down