You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a small scraping tool and I want to save based on the date and an identifier. So, for this a composite primary key is needed as I can have many rows with the same date and many rows with the same identifier but I want there to only be one for the combination of date and identifier.
I attempted: date = { "date", unique = true, primary = true }, appid = { "number", unique = true, primary = true },
but I get the error about there being two primary keys in the same table (which makes sense).
I cannot find how to create a composite key using this library. Is it possible or is that out of scope and I need to do the below?
I could do it using the "execute sql" and providing an sql string but I prefer not if something else is possible.
The following sql should create a composite key: CREATE TABLE something ( column1 INTEGER NOT NULL, column2 INTEGER NOT NULL, value, PRIMARY KEY ( column1, column2) );
The text was updated successfully, but these errors were encountered:
Small update.
I managed to create the table using execute from sqlite.lua but now I can't access that table. sqlite.lua has no idea of how that table looks or that it even exists.
I found a function called schema that seems like it could be used to get the "connection" to sqlite.lua but... Not quite it seems?
I'm trying to write a small scraping tool and I want to save based on the date and an identifier. So, for this a composite primary key is needed as I can have many rows with the same date and many rows with the same identifier but I want there to only be one for the combination of date and identifier.
I attempted:
date = { "date", unique = true, primary = true }, appid = { "number", unique = true, primary = true },
but I get the error about there being two primary keys in the same table (which makes sense).
I cannot find how to create a composite key using this library. Is it possible or is that out of scope and I need to do the below?
I could do it using the "execute sql" and providing an sql string but I prefer not if something else is possible.
The following sql should create a composite key:
CREATE TABLE something ( column1 INTEGER NOT NULL, column2 INTEGER NOT NULL, value, PRIMARY KEY ( column1, column2) );
The text was updated successfully, but these errors were encountered: