cldf / csvw

CSV on the web
Apache License 2.0
36 stars 5 forks source link

Add primary key to association table spec #37

Closed Anaphory closed 4 years ago

Anaphory commented 4 years ago

The occasion I did this was that I wanted to use SQLAlchemy's automap features with some CLDF database objects. I hope this will also my colleague who wants faster lookup of objects across association tables, because a primary key is necessarily indexed.

I worry that I don't understand the logics of context outside CLDF XXX_SourceTable tables well enough to be sure that this will always be a valid primary key (as opposed to being only unique if context is included). I'll open a separate issue to ask about context: #38

xrotwang commented 4 years ago

If this PR were to be merged, we would need to merge all reference contexts for the same source in a Source column before inserting the data in the db (e.g. consider a Source value of kaiping2019[1-10];meier1999[3];kaiping2019[p9 footnote] - how would you merge this?).