How to send data from Revit to SQLite database

Dear friends

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

Revit to SQLite.dyn (3.0 KB)

What version of Dynamo are you in?

Hi @JacobSmall
How are you?
I am working with version 1.3 :slightly_smiling_face:

Do you have any solution dear @JacobSmall?


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’.

As Jacob suggested- you need to use the SQLite_Command node (not query)

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:

"insert into DR_Schedule (RoomElementId,RoomLevel) values (" + RoomElementId + "'" + RoomLevel + "'" +")";

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.


Many many thanks @Andrew_Hannell

I’ll try it and let you know.