Closed sphuber closed 2 years ago
- The
id
property on theaiida.orm.Entity
class is deprecated. This is being called because the ORM proxy model declaresid
as the primary key field. This is correct for the database models of thePsqlDosBackend
inaiida-core
, but the front-end ORM is using thepk
property instead.
Hehe, so the PK made its way from being the primary key in the database backend to the frontend, and in the meanwhile it's actually gone from the backend?
Should we change the backend column name from id
to pk
then?
Hehe, so the PK made its way from being the primary key in the database backend to the frontend, and in the meanwhile it's actually gone from the backend? Should we change the backend column name from
id
topk
then?
From the very beginning the database models chose id
as the primary key, and Django provides the pk
as alias. In the front end, we encouraged using pk
, since id
is a reserved keyword in Python. That's why we deprecated the id
property on the front end ORM, however, the since the QueryBuilder
still requires projecting and filtering on id
since that operates (currently) directly on the database models, we never removed it.
@chrisjsewell actually opened a PR on aiida-core
quite some time ago, that would correct this discrepancy in user interface. We should definitely look into this again and include it in the discussion of providing a single client-facing schema for both Python API, as well as other API's such as the web API.
The warnings are enabled by setting the
AIIDA_WARN_v3
environment variable toTrue
in the CI workflow.Most of the warnings are addressed, but a few remain that cannot be trivially fixed:
id
property on theaiida.orm.Entity
class is deprecated. This is being called because the ORM proxy model declaresid
as the primary key field. This is correct for the database models of thePsqlDosBackend
inaiida-core
, but the front-end ORM is using thepk
property instead.attributes
,extras
andrepository_metadata
of the proxy models are declared "top-level" and sopydantic
will set them on the ORM instance using that property, however, these properties have been deprecated inaiida-core
and should be set through thebase.attributes.set_many
,base.extras.set_many
and thebase.repository.metadata
properties instead.With the current setup using
pydantic
it is not clear how these changes can be addressed and whether the manner in which field values are being set on the underlying ORM model instance can be customized.