transientskp / tkp

A transients-discovery pipeline for astronomical image-based surveys
http://docs.transientskp.org/
BSD 2-Clause "Simplified" License
19 stars 14 forks source link

SAWarning #611

Closed dentalfloss1 closed 1 year ago

dentalfloss1 commented 1 year ago

I just installed TraP 6.0rc to my machine and when I run trap-manage.py -h I get the following warnings:

 trap-manage.py -h
/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/db/quality.py:10: SAWarning: relationship 'Extractedsource.runningcatalogs' will copy column extractedsource.id to column assocxtrsource.xtrsrc, which conflicts with relationship(s): 'Assocxtrsource.xtrsrc' (copies extractedsource.id to assocxtrsource.xtrsrc). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="xtrsrc"' to the 'Extractedsource.runningcatalogs' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  'rms': Rejectreason(id=0, description='RMS invalid'),
/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/db/quality.py:10: SAWarning: relationship 'Extractedsource.runningcatalogs' will copy column runningcatalog.id to column assocxtrsource.runcat, which conflicts with relationship(s): 'Assocxtrsource.runcat' (copies runningcatalog.id to assocxtrsource.runcat). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="runcat"' to the 'Extractedsource.runningcatalogs' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  'rms': Rejectreason(id=0, description='RMS invalid'),
/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/db/quality.py:10: SAWarning: relationship 'Runningcatalog.extractedsources' will copy column runningcatalog.id to column assocxtrsource.runcat, which conflicts with relationship(s): 'Assocxtrsource.runcat' (copies runningcatalog.id to assocxtrsource.runcat). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="runcat"' to the 'Runningcatalog.extractedsources' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  'rms': Rejectreason(id=0, description='RMS invalid'),
/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/db/quality.py:10: SAWarning: relationship 'Runningcatalog.extractedsources' will copy column extractedsource.id to column assocxtrsource.xtrsrc, which conflicts with relationship(s): 'Assocxtrsource.xtrsrc' (copies extractedsource.id to assocxtrsource.xtrsrc). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="xtrsrc"' to the 'Runningcatalog.extractedsources' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  'rms': Rejectreason(id=0, description='RMS invalid'),
usage: trap-manage.py [-h] {initproject,initjob,run,initdb,deldataset} ...

        A tool for managing TKP projects.

        Use 'initproject' to create a project directory. Other Subcommands
        should be run from within a project directory.

        NB:
        To overwrite the database settings in pipeline.cfg you can use these
        environment variables to configure the connection:

        * TKP_DBENGINE
        * TKP_DBNAME
        * TKP_DBUSER
        * TKP_DBPASSWORD
        * TKP_DBHOST
        * TKP_DBPORT

        (This is useful for setting up test databases, etc.)

positional arguments:
  {initproject,initjob,run,initdb,deldataset}
    initproject         Initialize a pipeline project directory, complete with config files which you can use to configure your pipeline.
    initjob             Create a job folder, complete with job-specific config files which you will need to modify.
    run                 Run a job by specifying the name of the job folder.
    initdb              Initialize a database with the TKP schema.
    deldataset          Delete a dataset from a database

options:
  -h, --help            show this help message and exit
AntoniaR commented 1 year ago

These warnings could be related to old SQLAlchemy code, but do not impact the results. I suggest we ignore this warning for now unless there is a quick fix that can hide it.

HannoSpreeuw commented 1 year ago

Same as #597

Popped up when converting to Python 3.

I studied the SQLAlchemy documentation, but I do not yet fully understand the nature of the problem.

viewonly=True fixes it, but there is some doubt whether this is a proper solution.