computed fields should be persisted via metadata
Computed fields can be added via the metadata api but they are not exported or persisted via the metadata.json file.
This is critical for reproducible dockerized deployments.
@mikyoengine ~~This has been fixed in the latest release which is beta.9~~
@tirumaraiselvan I updated to beta.9 and am still not seeing this feature (both the release notes and via the console).
In fact, the addition of computed fields seems to break the metadata import. Steps to reproduce:
- Add a computed field via the metadata api
POST /query
{
"type":"add_computed_field",
"args":{
"table":{
"name":"job",
"schema":"public"
},
"name":"status",
"definition":{
"function":{
"name":"current_status",
"schema":"public"
},
"table_argument":"job_row"
}
}
}
- Export the metadata from the console
- Try to import the metadata back in the console (no edits)
- The console displays an error:
{
"statement": "DELETE FROM hdb_catalog.hdb_table WHERE is_system_defined <> 'true'",
"prepared": false,
"error": {
"exec_status": "FatalError",
"hint": null,
"message": "update or delete on table \"hdb_table\" violates foreign key constraint \"hdb_computed_field_table_schema_fkey\" on table \"hdb_computed_field\"",
"status_code": "23503",
"description": "Key (table_schema, table_name)=(public, job) is still referenced from table \"hdb_computed_field\"."
},
"arguments": []
}
Thanks for looking into this
This is fixed by #3211, which has not been merged yet (and therefore did not make it into the beta.9 release) but should be merged shortly. The fix will be in the next release.
Thanks for the quick response. Will look for the feature in the next release. Much needed feature. Thanks!