daneshpatel / sqlalchemy-jdbcapi

SQLAlchemy dialect for JDBC supported database. (Using JDBCAPI)
Other
23 stars 25 forks source link

Added Microsoft SQL Server Connection #7

Closed astromness closed 3 years ago

astromness commented 3 years ago

Created sqlserverjdbc.py

Tested with my local mssql server running inside of a docker and it appears to be working. There's not any contributing notes so let me know if I need to update anything.

astromness commented 3 years ago

I was going to be making some local changes to my project to do essentially this work and figured I'd contribute to the project. That way I can just use the pip import when it get's merged and updated.

astromness commented 3 years ago

I found a problem with a problem coming from sqlalchemy interacting with mssql jdbc. Need to solve before anything is merged. It appears sqlalchemy is not converting datetime.datetime objects when performing executes. Causing this error:

TypeError: No matching overloads found for com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,datetime.datetime), options are: public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,int) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,int,java.lang.Integer,int,boolean) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,int,java.lang.Integer,int) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,int,int) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,java.sql.SQLType,java.lang.Integer,java.lang.Integer) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,java.sql.SQLType,java.lang.Integer,java.lang.Integer,boolean) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,java.sql.SQLType,int) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object) throws com.microsoft.sqlserver.jdbc.SQLServerException public final void com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(int,java.lang.Object,java.sql.SQLType) throws com.microsoft.sqlserver.jdbc.SQLServerException

This could be an issue with using the MSDialect but am unsure how the datetime.datetime conversion is supposed to occur within jaydebeapi (Java.Timestamp I presume)