datajoint-python icon indicating copy to clipboard operation
datajoint-python copied to clipboard

Could you please elaborate on modifying table definitions in the docs?

Open FlorianNeurosci opened this issue 3 years ago • 2 comments
trafficstars

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!

FlorianNeurosci avatar Aug 26 '22 11:08 FlorianNeurosci

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.

CBroz1 avatar Aug 26 '22 13:08 CBroz1

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

dimitri-yatsenko avatar Aug 30 '22 17:08 dimitri-yatsenko