pepkit / pipestat

Pipeline results reporting package
https://pep.databio.org/pipestat/
BSD 2-Clause "Simplified" License
4 stars 2 forks source link

Disable sqlmodel warning #166

Open khoroshevskyi opened 4 months ago

khoroshevskyi commented 4 months ago

Right now, whenever you want to report a result, sqlmodel raises warning, that sais this table is already created. Shouldn't it be disabled? https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

donaldcampbelljr commented 4 months ago

Can you show the example output?

khoroshevskyi commented 4 months ago

image

/home/bnt4me/virginia/venv/bbuploader/lib/python3.10/site-packages/sqlmodel/main.py:549: SAWarning: This declarative base already contains a class with the same class name and module name as pipestat.backends.db_backend.db_parsed_schema.bedfile__sample, and will be replaced in the string-lookup table.
  DeclarativeMeta.__init__(cls, classname, bases, dict_, **kw)
[WARNING] [17:10:52] [PIPESTAT] Initialize PipestatBackend
[WARNING] [17:10:52] [PIPESTAT] Initializing DBBackend for pipeline 'bedsets'
donaldcampbelljr commented 3 months ago

We solved this for the test suite by placing the tests within context managers. (See: https://github.com/pepkit/pipestat/issues/48) However, this warning will still occur in normal usage if creating a model with an existing name.

We are appropriately setting extend_existing=True but this only allows us to create the model. It will still warn the user.

I'm not convinced that filtering all warnings is the correct way to proceed.

Perhaps we could load a model from an existing table? Via object reflection? https://docs.sqlalchemy.org/en/20/core/reflection.html

donaldcampbelljr commented 2 months ago

Per discussion, assigning this to Alex and I'm moving this to another milestone as it should not hold up 0.9.0.