ODBC to InvenTree prototype driver for KiCad.
See also: https://github.com/clj/kom for a previous prototype that uses SQLite virtual tables
Install unixODBC
$ brew install unixodbc
Download the latest kicad-odbc-middleware2 release from Releases:
decompress it and leave the kom2.dylib file somewhere convenient.
Contributions welcome.
Download the latest kicad-odbc-middleware2 Windows installer from Releases and run it.
Create a inventree.kicad_dbl
file with a valid configuration (see the KiCad documentation on Database Libraries), e.g.:
{
"meta": {
"version": 0
},
"name": "InvenTree Library",
"description": "Components pulled from InvenTree",
"source": {
"type": "odbc",
"connection_string": "Driver=SEE_BELOW;username=reader;password=readonly;server=https://demo.inventree.org",
"timeout_seconds": 2
},
"libraries": [
{
"name": "Capacitors",
"table": "Electronics/Passives/Capacitors",
"key": "pk",
"symbols": "parameter.Symbol",
"footprints": "parameter.Footprint",
"fields": [
{
"column": "IPN",
"name": "IPN",
"visible_on_add": false,
"visible_in_chooser": true,
"show_name": true,
"inherit_properties": true
},
{
"column": "parameter.Capacitance",
"name": "Value",
"visible_on_add": true,
"visible_in_chooser": true,
"show_name": false
},
{
"column": "parameter.Package",
"name": "Package",
"visible_on_add": true,
"visible_in_chooser": true,
"show_name": false
}
],
"properties": {
"description": "description",
"keywords": "keywords"
}
}
]
}
The InvenTree Demo server does not seem to have IPNs for everything though, so the key should probably be pk
instead if that is the case (i.e. if IPN isn't unique).
The Driver
argument of the connection string is used to find the kom2 driver and the exact value used is platform specific.
Use Driver=kom2
when the driver was installed using the downloaded Windows installer.
Use Driver=/path/to/kom2.so
, using the correct path where the driver was downloaded and extracted.
Use Driver=/path/to/kom2.dylib
, using the correct path where the driver was downloaded and extracted.
username
password
apitoken
is used instead)server
apitoken
username
and password
are used)inventree.kicad_dbl
that you created earlierYou can now open the Schematic Editor and add a new component. The configured library should now be available.
You can query InvenTree using isql
by using a connection string:
isql -v -k "Driver=/.../kom2.dylib;username=reader;password=readonly;server=https://demo.inventree.org"
and run things like:
select * from Electronics/Passives/Resistors
or
select * from Electronics/Passives/Resistors where pk = 43;
or
select * from Electronics/Passives/Resistors where IPN = ???;
if there were IPNs in the DB.
MIT License Copyright (c) 2023 Christian Lyder Jacobsen
Refer to LICENSE for full text.