r-dbi / dbi3

DBI revisited
https://r-dbi.github.io/dbi3
37 stars 2 forks source link

Allow creation of tables with primary key and/or index #4

Open pnacht opened 3 years ago

pnacht commented 3 years ago

The title is pretty self-explanatory.

Primary keys and indices are essential tools for performant SQL queries, but must currently be performed manually by the user after table creation with an ALTER TABLE call (made more complex for PK's by the fact that the respective columns must be NOT NULL, which must also be defined post-facto).

At a glance, at least PK's could be relatively simply implemented by adding an argument to dbCreateTable and modifying sqlCreateTable. Indices are made more complicated by the need to define them as clustered or non-clustered, but PK's seem quite simple (says the guy who hasn't actually tried doing it).

krlmlr commented 3 years ago

Thanks. Would you like to test-drive r-dbi/DBI#351?

krlmlr commented 2 years ago

Might be easier with a rewrite. Closing for now.