Connect Dynamo to SQLite3

Guys, I cannot establish a connection to a SQLite database from Dynamo. From Iron Python console it works fine as soon as sqlite3 library is included in the standard packages, but Dynamo returns a huge error. I tried both
import sqlite3
and
import clr
clr.AddReference(‘IronPython.SQLite’)
from dbapi2 import *
The error is IOError: System.IO.IOException: Could not add reference to assembly IronPython.SQLite

What is wrong?

Nikolay

You’ll need the Dynamo Slingshot nodes, plus the SQLite ODBC driver.
http://www.ch-werner.de/sqliteodbc/

I’m using the 64 bit version- have only used SELECT queries, not INSERT etc


Andrew

1 Like

correction

you don’t need the ODBC- Slingshot by itself will do it

Thx, it works, I know, but I’d like to implement more advanced queries, so I need to script.
Anyway, if I have an external library for IronPython, can I use it in Dynamo?

I’m not sure- but one of the Python gurus on this forum can probably help.

Out of interest- are these queries UPDATE, INSERT or more complicated cross table joins etc?
I have not tried anything beyond SELECT using the Slingshot nodes- but expect it should work…?

Andrew

I want to use lists in queries, so I need to organize “for” cycle to query for each element in the list and collect results in another list.

Level up! The question is: how to connect an external Python library apart from Revit API and related.

1 Like

I’d suggest creating a new post with a different title

Incidentally for this question:- [quote=“Nikolay_Gerasimov1, post:6, topic:4344”]
query for each element in the list and collect results in another list
[/quote]

You can do that like this: