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

initdb string parsing error #612

Closed dentalfloss1 closed 1 year ago

dentalfloss1 commented 1 year ago

I tried to initdb a new database and got the following traceback: `/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'),

This script will populate a database with these settings:

engine:     'postgresql'           ;
database:   newdb
user:       sarah
password:   sarah
host:       localhost
port:       5432

Do you want to continue? [y/N]: y Traceback (most recent call last): File "/home/sarah/Environments/trap/bin/trap-manage.py", line 10, in tkp.management.main() File "/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/management.py", line 376, in main args.func(args) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/management.py", line 246, in init_db populate(dbconfig) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/db/sql/populate.py", line 134, in populate get_database_config(dbconfig, apply=True) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/config/init.py", line 114, in get_database_config tkp.db.Database(*combined) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/tkp/db/database.py", line 86, in init self.alchemy_engine = create_engine('%s://%s:%s@%s:%s/%s' % File "", line 2, in create_engine File "/home/sarah/Environments/trap/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 375, in warned return fn(args, kwargs) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 514, in create_engine u = _url.make_url(url) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 738, in make_url return _parse_url(name_or_url) File "/home/sarah/Environments/trap/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 799, in _parse_url raise exc.ArgumentError( sqlalchemy.exc.ArgumentError: Could not parse SQLAlchemy URL from string ''postgresql' ;://sarah:sarah@localhost:5432/newdb' `** pipeline_cfg.txt Attached is the pipeline.cfg file (renamed to make github happy)

I think I have a fix: the ; after 'postgresql' just needs to be on the next line.

dentalfloss1 commented 1 year ago

This also true of the line with "multiproc" and "cores"

AntoniaR commented 1 year ago

Agreed, this just needs a minor update in the job_params.cfg template. I will fix.

AntoniaR commented 1 year ago

Solved in the master branch.