JHUAPL-DTNMA / dtnma-camp

The DTNMA source generator
https://jhuapl-dtnma.github.io/dtnma-camp/
Apache License 2.0
0 stars 0 forks source link

error in camp-generated sql file for `ion_bpsec_admin.json` #13

Open mfarina1 opened 1 month ago

mfarina1 commented 1 month ago

NOTE: this issue was copied over from the archived anms-camp repo found here

The camp-generated sql file for the ion_bpsec_admin.json ADM throws an error when executed in the ANMS database. Example error messages:

From an integration test in the https://github.com/JHUAPL-DTNMA/dtnma-camp/pull/1 CI/CD:

        with open(sql_file, "r") as f:
>           cursor.execute(f.read())
E           psycopg2.errors.UndefinedTable: relation "public.vw_ari_union" does not exist
E           LINE 1: amp_agent_op_plusuint_aid = (select obj_id FROM public.vw_ar...
E                                                                   ^
E           QUERY:  amp_agent_op_plusuint_aid = (select obj_id FROM public.vw_ari_union WHERE obj_name = 'plusUINT' and adm_name = (select adm_name from public.vw_namespace where name_string = 'Amp/Agent')  and actual = true)
E           CONTEXT:  PL/pgSQL function inline_code_block line 622 at assignment

Same test when ran locally:

        with open(sql_file, "r") as f:
>           cursor.execute(f.read())
E           psycopg2.errors.NotNullViolation: null value in column "obj_actual_definition_id" of relation "ari_collection_actual_entry" violates not-null constraint
E           DETAIL:  Failing row contains (68, null).
E           CONTEXT:  SQL statement "INSERT INTO ari_collection_actual_entry(ac_entry_id, obj_actual_definition_id) VALUES(r_ac_entry_id, p_definition_id)"
E           PL/pgSQL function sp__insert_ac_actual_entry(integer,integer,integer,integer) line 5 at SQL statement
E           SQL statement "CALL SP__insert_ac_actual_entry(var_ac_id, amp_agent_op_plusuint_aid, 3, r_ac_entry_id_3 )"
E           PL/pgSQL function inline_code_block line 623 at CALL

where cursor is the cursor of a connection to the ANMS library (using psycopg2), and sql_file is the camp-generated sql file.

mfarina1 commented 1 month ago

Will be resolved by SQL API changes being worked on by @njbrunner and @d-linko