Composite Keys

rcoombe

New member
I built a database with composite keys. When I configure dadabik to use the database (an MSSQL database), any field that is part of the composite key gets duplicated in all of the various references. I realize that there are varying opinions in the database administration industry regarding the use of composite keys, but it would be nice if dadabik would support this feature and generate only a single field reference for each element in the composite key. I am currently re-designing my database to use a separate identifying key in order to work around the issue rather than waiting for a modification to dadabik. However, this will add complications to the data extracts from a legacy system that I am replacing.

If there is something I am missing regarding the use of composite keys, that would be quite helpful.

Thanks,
Rich
 

eugenio

Administrator
Staff member
Hello Rich,
at the moment primary keys composed by multiple columns are not supported, see https://dadabik.com/index.php?function=show_documentation#bugs.

The plan is to add the support in future but probably not in the near future; an additional complication about using composed primary keys is the fact that for some features DaDaBIK relies on the existence of an auto increment field.

Best,
 

ONM

New member
I too have a requirement to use composite keys. Has there been any movement in this area since 2019 or any planned new features around composite keys?
And if I was to configure composite keys at the DB (MariaDB) level, with an optional DaDaBik autoincrement Pri key, what, if any, are the implications? I note a post (albeit 2016) about unexpected row deletion when composite keys are configured. Along with the age of the post and it not making sense to me, I assume this is not an issue. Or is it?
 

eugenio

Administrator
Staff member
Check the config parameter $add_additional_dadabik_id_field, that's the easiest workaround for MySQL.
 

DAF ID3000

Member
Hi all.

I use composite keys (with up to 10 fields) for several years with Dadabik...
I just took the habit to add an auto increment unique key into my SQL table, and I use it in dadabik as unique field in my 'Page based on...' definition.
No problem so far since you don't even need to tell Dadabik about composite key...
The only limitation is, of course, if you need to reference records from a SELECT_SINGLE: you need to link the auto-incremented value or you'll get duplicated values.
hope it helps...
 
Top