datajoint-python
datajoint-python copied to clipboard
Could you please elaborate on modifying table definitions in the docs?
Feature Request
Problem
In the documentation under "Table definition" it says that "It is possible to modify a table without dropping it. This topic is covered separately.". I tried to search but I cannot find the topic being covered elsewhere, so I was wondering if you could kindly elaborate on the topic and maybe link it there?
Justification
It would be very nice to retrospectively be able to modify table definitions without dropping them altogether
Thank you very much!
Duplicate issue on datajoint-docs?
If I recall correctly, alter will let you modify the secondary attributes of a table. You can do this by modifying your local table definition, loading that into the current namespace and then running schema.Table.alter(). This should update the SQL representation of the table to reflect what's in your script. Although, this should be done with caution - I'm not clear on how this would impact existing data that, for example, did not match the new definition's data type.
Quick tutorial:
- https://www.youtube.com/watch?v=utrbqjhk9_s
- https://github.com/datajoint-company/db-programming-with-datajoint#2019-04-26-altering-table-definitions