Skip to content

Conversation

@kaseyLee123
Copy link
Contributor

@kaseyLee123 kaseyLee123 commented Jun 12, 2025

Ingest Roth24 companion parameters such as age and metalicity

Link to relevant issue: Closes #613

For data ingests:

  • includes script used for ingest
  • includes modified JSON files
  • Add new tests
  • Update the Versions table

@kelle
Copy link
Collaborator

kelle commented Jun 12, 2025

Great start!

@kaseyLee123
Copy link
Contributor Author

Not really sure what this error means

/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/astrodbkit/astrodb.py:939: SAWarning: Column 'Publications.name' is marked as a member of the primary key for table 'Publications', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed. Primary key columns typically may not store NULL. conn.execute(self.metadata.tables[table].insert().values(data)) Traceback (most recent call last): File "/Users/kasey/Documents/GitHub/SIMPLE-db/scripts/ingests/roth24/ingest_companion_parameters.py", line 22, in <module> db = load_astrodb("SIMPLE.sqlite", recreatedb=RECREATE_DB, reference_tables=REFERENCE_TABLES) File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/astrodb_utils/utils.py", line 77, in load_astrodb db.load_database(data_path) ~~~~~~~~~~~~~~~~^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/astrodbkit/astrodb.py", line 1003, in load_database self.load_table(table, os.path.join(directory, reference_directory), verbose=verbose) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/astrodbkit/astrodb.py", line 939, in load_table conn.execute(self.metadata.tables[table].insert().values(data)) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1416, in execute return meth( self, distilled_parameters, execution_options or NO_OPTIONS, ) File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection return connection._execute_clauseelement( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ self, distilled_params, execution_options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 1630, in _execute_clauseelement compiled_sql, extracted_params, cache_hit = elem._compile_w_cache( ~~~~~~~~~~~~~~~~~~~~~^ dialect=dialect, ^^^^^^^^^^^^^^^^ ...<4 lines>... linting=self.dialect.compiler_linting | compiler.WARN_LINTING, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 717, in _compile_w_cache compiled_sql = self._compiler( dialect, ...<4 lines>... **kw, ) File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/elements.py", line 317, in _compiler return dialect.statement_compiler(dialect, self, **kw) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/compiler.py", line 1429, in __init__ Compiled.__init__(self, dialect, statement, **kwargs) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/compiler.py", line 870, in __init__ self.string = self.process(self.statement, **compile_kwargs) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/compiler.py", line 915, in process return obj._compiler_dispatch(self, **kwargs) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/visitors.py", line 141, in _compiler_dispatch return meth(self, **kw) # type: ignore # noqa: E501 File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/compiler.py", line 5790, in visit_insert crud_params_struct = crud._get_crud_params( self, ...<4 lines>... **kw, ) File "/opt/miniconda3/envs/simple-db/lib/python3.13/site-packages/sqlalchemy/sql/crud.py", line 335, in _get_crud_params raise exc.CompileError( ...<2 lines>... ) sqlalchemy.exc.CompileError: Unconsumed column names: reference

@kelle
Copy link
Collaborator

kelle commented Jun 13, 2025

The database isn't being loaded properly because your call to load_astrodb doesn't include the pointer to the schema.

Comment on lines 20 to 21
RECREATE_DB = True # recreates the .db file from the data files
# LOAD THE DATABASE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RECREATE_DB = True # recreates the .db file from the data files
# LOAD THE DATABASE
RECREATE_DB = True # recreates the .db file from the data files
SCHEMA_PATH = "simple/schema.yaml"
# LOAD THE DATABASE

@kelle
Copy link
Collaborator

kelle commented Jun 13, 2025

And we actually hadn't added the CompanionParameters table yet! I've added it to the schema.yaml file and pushed to your branch.

@kelle kelle requested a review from rothermichaustin June 18, 2025 15:55
@kelle
Copy link
Collaborator

kelle commented Jun 18, 2025

@kaseyLee123: This looks great! Really good work! Please work with @canavarrete01 to merge with main.

@rothermichaustin , please do a spot check of the JSON files and make sure the data looks as expected.

@kelle kelle requested a review from canavarrete01 June 18, 2025 15:57
@kelle
Copy link
Collaborator

kelle commented Jun 24, 2025

Since we're adding the CompanionList table, I wonder if we should also add the other_companion_name column to the CompanionList table also. Currently, it's in CompanionRelationships. I would be ok with just adding other_companion_name to CompanionList and also leaving it CompanionRelationships for the moment.

@kaseyLee123
Copy link
Contributor Author

Since we're adding the CompanionList table, I wonder if we should also add the other_companion_name column to the CompanionList table also. Currently, it's in CompanionRelationships. I would be ok with just adding other_companion_name to CompanionList and also leaving it CompanionRelationships for the moment.

I think that makes sense. I can go do that. That would mean I have to reingest the companion list right?

@kelle
Copy link
Collaborator

kelle commented Jun 24, 2025

I think that makes sense. I can go do that. That would mean I have to reingest the companion list right?

Yep! You'll have to re-run that script.

@kelle
Copy link
Collaborator

kelle commented Jun 24, 2025

(I would also update the branch using the button here OR git pull upstream main into your branch.)

@kaseyLee123
Copy link
Contributor Author

I think that makes sense. I can go do that. That would mean I have to reingest the companion list right?

Yep! You'll have to re-run that script.

i just reran the script but i'd have to add something to my companion list script to add to the other_companion_names right? For that would I just use what the ingest_companion_relationships function uses or do you recommend something else

Copy link
Collaborator

@kelle kelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine with me to keep other_companion_names all blank for the moment. I think this is good to merge!

@kelle
Copy link
Collaborator

kelle commented Jun 26, 2025

Kasey, one more thing. Add a test that touches the companion parameters you added. It should go in the test/test_data.py module and you can get inspiration from test_modeledparameters_refs and test_companion_relations

Comment on lines 290 to 291


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete these lines

@kaseyLee123
Copy link
Contributor Author

Kasey, one more thing. Add a test that touches the companion parameters you added. It should go in the test/test_data.py module and you can get inspiration from test_modeledparameters_refs and test_companion_relations

I just pushed new code and ran pytest (which worked). Can you take a look over at it to make sure I did it correctly before I can merge?

@kaseyLee123 kaseyLee123 requested a review from kelle June 26, 2025 18:03
@kelle
Copy link
Collaborator

kelle commented Jun 26, 2025

Looks great! Do you have the power to Squash and Merge or should I do it?

@kaseyLee123
Copy link
Contributor Author

Looks great! Do you have the power to Squash and Merge or should I do it?

I think I do. I can go do that right now

@kaseyLee123 kaseyLee123 merged commit a9a1412 into SIMPLE-AstroDB:main Jun 26, 2025
3 checks passed
lesliech1004 pushed a commit to lesliech1004/SIMPLE-db that referenced this pull request Jul 23, 2025
* ingest companion parameters

* update + new csv file

* commented out unnecessary code

* adding CompanionParameters and CompanionList tables to the schema

* implement cruz's changes + unconsumed column for reference is fixed

* updated schema+parameters.json, updated csv file

* comment

* companionlist script + further bug testing in parameters

* removed unnecessary

* added companion list to reference table to fix pytest error

* updated companion list json file

* edit the ingesting publication logic

* finished script + updated json files!!

* Revert "finished script + updated json files!!"

This reverts commit ad484d3.

* changes

* publication unicode changed within

* schema update

* Revert "schema update"

This reverts commit 2f2a179.

* reingested companion list with changed schema

* updated json files with no unicode

* update test_data with companion_param cases

* remove unnecessart spaces

---------

Co-authored-by: kelle <kellecruz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ingest Roth24 companion parameters

2 participants