0

In connection with the question on ORM for Julia I am wondering how to get about using SQLAlchemy in Julia given that SQLAlchemy uses a lot of object/type magic to load and persist data. Do you have any hints how to use Julia structures in the context of SQLAlchemy?

(I am sorry, I am new to Julia, just looking around at this point and I am currently unable to come up with some code for a start - as MCVE).

sophros
  • 14,672
  • 11
  • 46
  • 75

1 Answers1

1

The package PyCall.jl lets you load and use arbitrary python packages, including SQLAlchemy.

julia> using PyCall

julia> @pyimport sqlalchemy as sql

julia> sql.__version__
"1.1.9"

Please see it's documentation for further details.

As of now there are some arguably inconvenient syntax mappings necessary. Concretely, you must access python object fields and methods by object[:field] instead of object.field which you'd use in python. Nevertheless, since my pull request has been merged this week this is going to change once PyCall 2.0 is out! (Of course you can checkout the master branch through ] add PyCall#master and get this feature already now.)

carstenbauer
  • 9,817
  • 1
  • 27
  • 40