diff --git a/HISTORY.rst b/HISTORY.rst index d7b3866..46c1e74 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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. diff --git a/aioradio/ds_utils.py b/aioradio/ds_utils.py index 0b02074..c155751 100644 --- a/aioradio/ds_utils.py +++ b/aioradio/ds_utils.py @@ -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 diff --git a/aioradio/requirements.txt b/aioradio/requirements.txt index f100ad8..621c3a3 100644 --- a/aioradio/requirements.txt +++ b/aioradio/requirements.txt @@ -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 @@ -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 diff --git a/setup.py b/setup.py index c815fb5..ab4b5e8 100644 --- a/setup.py +++ b/setup.py @@ -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",