4D database and SQLAlchemy

9 views
Skip to first unread message

Prachi Jain

unread,
Sep 13, 2021, 2:36:37 PMSep 13
to sqlalchemy

Hi,

I am new to SQLAlchemy as well as 4D. I  am trying to write a dialect for 4D database (it is a relational database) to work with SQLAlchemy but I have run into many errors. I have tried to write my code on the basis of existing sqlalchemy-access dialect as well as looked at existing dialects code to understand how to write a dialect. But I always get a No Database connection when i go through the ODBC sql trace. I am trying to connect through the pyodbc extension as 4D connects well through pyodbc independently (without the SQLAlchemy presence).
I noticed that I get a MockConnection from the create_engine call. In the debug mode I noticed that instead of going through the Dialect I am writing, code goes through the DefaultDialect, even though it shows the dialect object to be of my custom class. Also i believe since it is not going through my custom class it throws this error on the console - "AttributeError: 'FourDDialect' object has no attribute 'driver'"
I am not sure what I am doing wrong or what is missing in my code. I appreciate any / all help anyone can provide on this.
I am using pyCharm editor and on the latest version of sqlalchmey. Trying to integrate 4D version 14.3. I have pyodbc.cp39-win_amd64.pyd and working on Windows 10.
One last thing, I found this very old thread about 4D https://sqlalchemy.narkive.com/fZ6LTA0X/generic-odbc-connection-4d-anyone, and am wondering if there was any luck with 4D here and if in the last 12 years someone came up with a 4D dialect and can share some insights?

Thank you very much,
Prachi
Reply all
Reply to author
Forward
0 new messages