Skip to content

Commit

Permalink
Merge pull request #49 from cal-itp/update-sqlalchemy-bigquery
Browse files Browse the repository at this point in the history
calitp(dependencies): added sqlalchemy-bigquery to calitp-py, removed pybigquery
  • Loading branch information
charlie-costanzo authored Apr 7, 2022
2 parents 8136150 + 3d9c6b5 commit bee9e9c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion calitp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# flake8: noqa

__version__ = "0.0.12"
__version__ = "0.0.13"

from .sql import get_table, write_table, query_sql, to_snakecase, get_engine
from .storage import save_to_gcfs, read_gcfs
25 changes: 20 additions & 5 deletions calitp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,28 @@

@app.command()
def random_protobuff(
glob=typer.Argument("*", help="A glob matching itp_id/url_number/string.",),
bucket=typer.Option("gtfs-data", help="GCS bucket to search.",),
date=typer.Option(f"{datetime.date.today()}*", help="Date glob.",),
format=typer.Option("protobuff", help="format to output, json or protobuff.",),
glob=typer.Argument(
"*",
help="A glob matching itp_id/url_number/string.",
),
bucket=typer.Option(
"gtfs-data",
help="GCS bucket to search.",
),
date=typer.Option(
f"{datetime.date.today()}*",
help="Date glob.",
),
format=typer.Option(
"protobuff",
help="format to output, json or protobuff.",
),
):
blob, data, error = get_random_protobuff(
glob, bucket=bucket, date=date, format=format,
glob,
bucket=bucket,
date=date,
format=format,
)
data = str(data)
print(f"downloaded {blob}")
Expand Down
4 changes: 1 addition & 3 deletions calitp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ def format_table_name(name, is_staging=False, full_name=False):


def pipe_file_name(path):
"""Returns absolute path for a file in the pipeline (e.g. the data folder).
"""
"""Returns absolute path for a file in the pipeline (e.g. the data folder)."""

# For now, we just get the path relative to the directory holding the
# DAGs folder. For some reason, gcp doesn't expose the same variable
Expand Down
6 changes: 5 additions & 1 deletion calitp/tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ def test_write_table(tmp_name):
with as_pipeline():
write_table(df, tmp_name)

tbl = AutoTable(get_engine(), lambda s: s, lambda s: True,) # s.replace(".", "_"),
tbl = AutoTable(
get_engine(),
lambda s: s,
lambda s: True,
) # s.replace(".", "_"),

tbl._init()

Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ filelock==3.0.12
fsspec==2021.6.0
future==0.18.2
gcsfs==0.8.0
google-api-core==1.30.0
google-api-core==2.7.1
google-auth==1.31.0
google-auth-oauthlib==0.4.4
google-cloud-bigquery==2.16.1
google-cloud-bigquery==2.25.2
google-cloud-bigquery-storage==2.8.0
google-cloud-core==1.7.0
google-cloud-core==2.2.3
google-crc32c==1.1.2
google-resumable-media==1.3.0
googleapis-common-protos==1.53.0
grpcio==1.38.0
grpcio==1.44.0
identify==2.2.10
idna==2.10
iniconfig==1.1.1
Expand Down Expand Up @@ -74,7 +74,7 @@ py==1.10.0
pyarrow==4.0.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pybigquery==0.7.0
sqlalchemy-bigquery==1.4.3
pycparser==2.20
pydata-google-auth==1.2.0
Pygments==2.9.0
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ filelock==3.0.12
fsspec==2021.6.0
future==0.18.2
gcsfs==0.8.0
google-api-core==1.30.0
google-api-core==2.7.1
google-auth==1.31.0
google-auth-oauthlib==0.4.4
google-cloud-bigquery==2.16.1
google-cloud-core==1.7.0
google-cloud-bigquery==2.25.2
google-cloud-core==2.2.3
google-crc32c==1.1.2
google-resumable-media==1.3.0
googleapis-common-protos==1.53.0
grpcio==1.38.0
grpcio==1.44.0
gtfs-realtime-bindings==0.0.7
identify==2.2.10
idna==2.10
Expand Down Expand Up @@ -52,7 +52,7 @@ ptyprocess==0.7.0
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pybigquery==0.7.0
sqlalchemy-bigquery==1.4.3
pycparser==2.20
pydata-google-auth==1.2.0
Pygments==2.9.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"gcsfs",
"pandas",
"pandas-gbq",
"pybigquery",
"sqlalchemy-bigquery",
"google-cloud-bigquery",
"gtfs-realtime-bindings",
],
Expand Down

0 comments on commit bee9e9c

Please sign in to comment.