You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to query all ProcessMetaData from my local postgres database, using the ORM.
But using the following command response = session.query(pycram.orm.base.ProcessMetaData).all() returns only a list containing one object instead of all objects as expected.
Detailed
I am using the following postgres version: PostgreSQL 14.10 (Ubuntu 14.10-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit
My ProcessMetaData has the following definition:
pycram=# \d "ProcessMetaData"
Table "public.ProcessMetaData"
Column | Type | Collation | Nullable | Default
----------------+-----------------------------+-----------+----------+-----------------------------------------------
created_at | timestamp without time zone || not null | CURRENT_TIMESTAMP
created_by | character varying(255) || not null |
description | character varying(255) || not null |
pycram_version | character varying(255) |||
id | integer || not null | nextval('"ProcessMetaData_id_seq"'::regclass)
Indexes:
"ProcessMetaData_pkey" PRIMARY KEY, btree (id)
Referenced by:
TABLE ""Code"" CONSTRAINT "code_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Color"" CONSTRAINT "color_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Designator"" CONSTRAINT "designator_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Object"" CONSTRAINT "object_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Pose"" CONSTRAINT "pose_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Position"" CONSTRAINT "position_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""Quaternion"" CONSTRAINT "quaternion_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""RobotState"" CONSTRAINT "robotstate_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
TABLE ""TaskTreeNode"" CONSTRAINT "tasktreenode_process_metadata_id_fkey" FOREIGN KEY (process_metadata_id) REFERENCES "ProcessMetaData"(id) ON UPDATE CASCADE
It contains the following data:
pycram=# select * from "ProcessMetaData";
created_at | created_by | description | pycram_version | id
----------------------------+------------+-----------------------------------------------------+------------------------------------------+----
2023-12-22 14:16:49.281148 | nleusmann | Unittest: All that is gold does not glitter, 0 | af343656dd2d615259c5df4543b56260cf8d358e | 7
2023-12-22 14:17:01.399586 | nleusmann | Unittest: Not all those who wander are lost; 1 | af343656dd2d615259c5df4543b56260cf8d358e | 8
2023-12-22 14:17:13.865826 | nleusmann | Unittest: The old that is strong does not wither, 2 | af343656dd2d615259c5df4543b56260cf8d358e | 9
2023-12-22 13:22:11 | nleusmann | Database merger Unittest: Example pick and place 0 | af343656dd2d615259c5df4543b56260cf8d358e | 10
2023-12-22 13:22:24 | nleusmann | Database merger Unittest: Example pick and place 1 | af343656dd2d615259c5df4543b56260cf8d358e | 11
2023-12-22 13:22:36 | nleusmann | Database merger Unittest: Example pick and place 2 | af343656dd2d615259c5df4543b56260cf8d358e | 12
2023-12-22 13:22:11 | nleusmann | Database merger Unittest: Example pick and place 0 | af343656dd2d615259c5df4543b56260cf8d358e | 1
2023-12-22 13:22:24 | nleusmann | Database merger Unittest: Example pick and place 1 | af343656dd2d615259c5df4543b56260cf8d358e | 2
2023-12-22 13:22:36 | nleusmann | Database merger Unittest: Example pick and place 2 | af343656dd2d615259c5df4543b56260cf8d358e | 3
2023-12-22 13:22:50 | nleusmann | Database merger Unittest: Example pick and place 0 | af343656dd2d615259c5df4543b56260cf8d358e | 4
2023-12-22 13:23:03 | nleusmann | Database merger Unittest: Example pick and place 1 | af343656dd2d615259c5df4543b56260cf8d358e | 5
2023-12-22 13:23:15 | nleusmann | Database merger Unittest: Example pick and place 2 | af343656dd2d615259c5df4543b56260cf8d358e | 6
When using the response = session.query(pycram.orm.base.ProcessMetaData).all() command, the only value that gets returned is the following:
[ProcessMetaData(id=6, created_at=datetime.datetime(2023, 12, 22, 13, 23, 15), created_by='nleusmann', description='Database merger Unittest: Example pick and place 2', pycram_version='af343656dd2d615259c5df4543b56260cf8d358e')]
Which is the most recently added object.
Curiously the count = session.query(pycram.orm.base.ProcessMetaData).count() returns the correct amount of 12.
[(datetime.datetime(2023, 12, 22, 14, 16, 49, 281148), 'nleusmann', 'Unittest: All that is gold does not glitter, 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 7), (datetime.datetime(2023, 12, 22, 14, 17, 1, 399586), 'nleusmann', 'Unittest: Not all those who wander are lost; 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 8), (datetime.datetime(2023, 12, 22, 14, 17, 13, 865826), 'nleusmann', 'Unittest: The old that is strong does not wither, 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 9), (datetime.datetime(2023, 12, 22, 13, 22, 11), 'nleusmann', 'Database merger Unittest: Example pick and place 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 10), (datetime.datetime(2023, 12, 22, 13, 22, 24), 'nleusmann', 'Database merger Unittest: Example pick and place 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 11), (datetime.datetime(2023, 12, 22, 13, 22, 36), 'nleusmann', 'Database merger Unittest: Example pick and place 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 12), (datetime.datetime(2023, 12, 22, 13, 22, 11), 'nleusmann', 'Database merger Unittest: Example pick and place 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 1), (datetime.datetime(2023, 12, 22, 13, 22, 24), 'nleusmann', 'Database merger Unittest: Example pick and place 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 2), (datetime.datetime(2023, 12, 22, 13, 22, 36), 'nleusmann', 'Database merger Unittest: Example pick and place 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 3), (datetime.datetime(2023, 12, 22, 13, 22, 50), 'nleusmann', 'Database merger Unittest: Example pick and place 0', 'af343656dd2d615259c5df4543b56260cf8d358e', 4), (datetime.datetime(2023, 12, 22, 13, 23, 3), 'nleusmann', 'Database merger Unittest: Example pick and place 1', 'af343656dd2d615259c5df4543b56260cf8d358e', 5), (datetime.datetime(2023, 12, 22, 13, 23, 15), 'nleusmann', 'Database merger Unittest: Example pick and place 2', 'af343656dd2d615259c5df4543b56260cf8d358e', 6)]
But instead of an list of all the different ProcessMetaData stored within my database I only receive an single object.
What is even more surprising is the fact that the counting command returns the :
Summery
I am trying to query all ProcessMetaData from my local postgres database, using the ORM.
But using the following command
response = session.query(pycram.orm.base.ProcessMetaData).all()
returns only a list containing one object instead of all objects as expected.Detailed
I am using the following postgres version:
PostgreSQL 14.10 (Ubuntu 14.10-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit
My ProcessMetaData has the following definition:
It contains the following data:
When using the
response = session.query(pycram.orm.base.ProcessMetaData).all()
command, the only value that gets returned is the following:Which is the most recently added object.
Curiously the
count = session.query(pycram.orm.base.ProcessMetaData).count()
returns the correct amount of 12.Utilizing the select statement.
I receive the expected return value:
But instead of an list of all the different ProcessMetaData stored within my database I only receive an single object.
What is even more surprising is the fact that the counting command returns the :
returns the correct amount of possible objects.
If needed I can provide additional information, please just ask.
The text was updated successfully, but these errors were encountered: