-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - Multiple and Single Primary and Unique Keys #8179
Labels
area/graphql
Issues related to GraphQL support on Dgraph.
community
Issue or PR created by the community.
kind/feature
Something completely new we should consider.
Stale
Comments
MichelDiz
added
kind/feature
Something completely new we should consider.
and removed
feature request
labels
Sep 9, 2022
This was referenced Nov 2, 2022
Splitting in several requests for tracking
|
adding composite keys in mutation without query(like upsert) may be a good idea |
This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/graphql
Issues related to GraphQL support on Dgraph.
community
Issue or PR created by the community.
kind/feature
Something completely new we should consider.
Stale
Related to this issue for reference.
Keys
Composite Key - has more than one attribute
Compound Key - a specific composite key where both attributes are also foreign keys
PK (Primary Key)
Single PK or @id (external id)
SQL
ADD PRIMARY KEY(username)
Composite PK or @id
SQL
ADD PRIMARY KEY(username, email)
Unique Keys (Unique)
Single Unique or @unique
SQL
ADD CONSTRAINT UNIQUE (username)
Multiple Uniques or @unique
SQL
Composite Uniques or @unique
SQL
ADD CONSTRAINT UNIQUE (firstName, lastName)
Compound Keys - composite keys on foreign keys or nested fields
SQL
In SQL, there would be a composite pk on the junction table [book_id_fk, user_id_fk, created_at]:
ADD PRIMARY KEY(book_id_fk, user_id_fk)
So theoretically, there should be a unique key on reviewer.id and book.id. This should also be possible for one foreign key, although I can't think of an example.
UPDATE: 11/2/22 - The @unique (not the @id) should be able to be null.
Referring to this post, you should also be able to get multiple fields based on their COMPOSITE primary or unique key(s) as well as individual unique keys, which is how it currently works:
So we really have a few feature requests here:
#2 is the main request here
J
Just for more reference - outcaste-io/issues#26
The text was updated successfully, but these errors were encountered: