I am trying to send data from my Revit model to SQLite tables. I could make a graph in dynamo to send data from SQLite database to update my Revit model, thanks from dear @Andrew_Hannell, but I couldn’t write a correct script till know. As shown in the picture I am going to send some parameters from my Revit model such as Element ID, Level, Type, Replacement Year and Replacement Cost to some pre-defined columns in a table namely DR_Schedule in SQLite Studio. I also attached my dynamo file here. If you open my file you can check my whole script. Any help and guidance are kindly appreciated. Thank u in advance
I don’t have the SQL database to test with so I can’t be too much help here, but it looks like you want to use a string node instead of a code block. Your formatting is throwing an error as a result of an quote.
Also, and take this with a grain of sand as Im not an SQL guy, that’s node indicates it’s for querying which usually means ‘get data from sql’ rather than ‘send data to sql’.
Your code block node is red because the syntax to build the SQL query string is not correct.
You need to concatenate everything to form the SQL
Fields whose data may contain spaces need to be enclosed in a ’ character, and need to be enclosed in " for Dynamo to treat it literally- so yours would be something like:
so the output from this node would be: insert into DR_Schedule (RoomElementId,RoomLevel) values (12345,'01 Entry Level')
I’d recommend not using spaces in the fields (column names) in your database- it just makes it more complicated. Start with just one field and build it up from there.
Hi Andrew, i know this topic is old, but how can you manage to operate with string and int64 from elemenId? I expected an error about operand types. thanks in advance.
I don’t recall any problems with datatypes- I could be wrong- but I think I’d have used a text datatype in a SQLite database for elementID.
I’ve been leaning towards Postgres/PostGIS recently for the spatial capabilities
If you have a specific problem- then post relevant files and I’ll take a look
edit: This was meant as a general reply, not specifically “at” @Andrew_Hannell
I use int for element Id values when going to SQL. I think It makes it easier to use coming back in if you need bidirectional communication from you DB.