Skip to content

Commit

Permalink
Suppress Sqlalchemy SAWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomasula committed Apr 27, 2022
1 parent 4e192e3 commit 5bc4abd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/odm2datamodels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
from .models import samplingfeatures
from .models import simulation

import warnings
warnings.simplefilter("ignore", category=sqlalchemy.exc.SAWarning)

OUTPUT_FORMATS = ('json', 'dataframe', 'dict')



class Base():

@declared_attr
Expand Down Expand Up @@ -84,7 +88,7 @@ def read_query(self,

# guard against invalid output_format strings
if output_format not in OUTPUT_FORMATS:
raise ValueError(f':param output_format = {output_format}, which is not one of the following valid output_format strings: {OUTPUT_FORMATS}')
raise ValueError(f':argument output_format={output_format}, is not a valid output_format strings: {OUTPUT_FORMATS}')

# use SQLAlchemy session to read_query and return response in the designated output_format
with self.session_maker() as session:
Expand Down

0 comments on commit 5bc4abd

Please sign in to comment.