I am trying to connect to an SQLite database. In the examples in this forum (@Andrew_Hannell) the Slingshot Query Node FilePath is linked to a file with a .sqlite extension. How is this file generated? (I have SQLite Studio - I can export to .sql but not .sqlite).
I’ve attached a very simple spreadsheet with 2 items. I would like to lookup the ID (Column A) using a value from Dynamo and retrieve the Description (Column B) from the database back into Dynamo.
there are a number of tutorials on how to create a table in SQLiteStudio- so I won’t repeat them here. Basically the steps are:
Create a database.
Create a table to contain your data, and columns in the table. You can do this via the UI, or with a query. To run a query, open the SQL editor and paste in the below, then hit the go button (F9)
CREATE TABLE TBL (
ID INTEGER (10) PRIMARY KEY,
Description TEXT (255),
Category_Abbreviation TEXT (255),
Notes TEXT (255),
Model TEXT (255),
K_Coefficient TEXT (255),
Specific_Loss TEXT (255),
Dimension_Image TEXT (255)
)
Populate the table. You can do this by importing a CSV file using the GUI, or another query:
Using a string as a File Path was where my code seemed to go wrong - changing this to the File Path node made it work.
The only thing I was never able to work out was how to get the database to a file with the extension x.sqlite? (the files I see when creating a new database are x.db, x.db.sqbpro, x.sql). I am able to open and manipulate your .sqlite file so it is easy for me to copy and edit it but I am still curious as to how it was first generated…
I tried to import door-related parameters from my Revit model to SQLite database, but as shown in the attached pics, I couldn’t. I think something is wrong here, but I don’t know what it is. The parameters could be successfully extracted from my Revit model, but cannot be sent to the SQLite database. Would you please look at my graph and tell me where the problem is? Thanks
Isn’t this the same question that you already asked in a different post (and I’ve already answered) ?
In SQL syntax, column names with spaces need to be enclosed in square brackets. As I’ve said, the simple solution is to not use spaces in column names. Otherwise, put your column names in square brackets in Dynamo.
Put a watch node on your SQL.InsertInto node and you will see that it is not properly formed SQL
it needs to be: Insert into TABLE([Field 1]) values ('xxxx1234')
not Insert into TABLE(Field 1) values ('xxxx1234')