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 bug with sql statement in function read_constants_from_db #117

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ History
=======


v0.20.4 (2023-12-01)

* Fix bug with sql statement in function ds_utils.read_constants_from_db.
* Update aiojobs==1.2.1.
* Update polars==0.19.18.


v0.20.3 (2023-11-29)

* Add Databricks functions to read/write constants for Data Science to use across projects.
Expand Down
4 changes: 2 additions & 2 deletions aioradio/ds_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def read_constants_from_db(constants_list=None):
"""Read all constants or pass in a list to filter constants."""

table = f"{db_catalog('prod')}.student_data.constants"
constants = '*' if constants_list is None else ','.join(constants_list)
mapping = {i['key']: json.loads(i['value']) for i in sql_to_polars_df(f'SELECT {constants} FROM {table}').to_dicts()}
where_clause = f'WHERE key in ({str(constants_list)[1:-1]})' if constants_list is not None else ''
mapping = {i['key']: json.loads(i['value']) for i in sql_to_polars_df(f'SELECT * FROM {table} {where_clause}').to_dicts()}

return mapping

Expand Down
4 changes: 2 additions & 2 deletions aioradio/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aioboto3==11.3.1
aiojobs==1.2.0
aiojobs==1.2.1
backoff==2.2.1
boto3==1.28.17
botocore==1.31.17
Expand All @@ -17,7 +17,7 @@ moto==3.1.18
openpyxl==3.0.10
orjson==3.8.10
pandas==2.1.3
polars==0.19.17
polars==0.19.18
pre-commit==3.5.0
psycopg2-binary==2.9.9
pyarrow==13.0.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
long_description = fileobj.read()

setup(name='aioradio',
version='0.20.3',
version='0.20.4',
description='Generic asynchronous i/o python utilities for AWS services (SQS, S3, DynamoDB, Secrets Manager), Redis, MSSQL (pyodbc), JIRA and more',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down