The official Postgresql JDBC driver is at http://jdbc.postgresql.org/.
-
"""
-from sqlalchemy.dialects.postgresql.base import PGDialect
+from sqlalchemy.dialects.postgresql.base import PGCompiler, PGDialect
from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
from sqlalchemy.engine import default
class PostgreSQL_jdbcExecutionContext(default.DefaultExecutionContext):
pass
+class PostgreSQL_jdbcCompiler(PGCompiler):
+
+ def post_process_text(self, text):
+ # Don't escape '%' like PGCompiler
+ return text
+
class PostgreSQL_jdbc(ZxJDBCConnector, PGDialect):
execution_ctx_cls = PostgreSQL_jdbcExecutionContext
+ statement_compiler = PostgreSQL_jdbcCompiler
jdbc_db_name = 'postgresql'
jdbc_driver_name = "org.postgresql.Driver"
-
def _get_server_version_info(self, connection):
return tuple(int(x) for x in connection.connection.dbversion.split('.'))
-dialect = PostgreSQL_jdbc
\ No newline at end of file
+dialect = PostgreSQL_jdbc
eng.execute("show transaction isolation level").scalar(),
'serializable')
eng = create_engine(testing.db.url, isolation_level="FOO")
- assert_raises(eng.dialect.dbapi.ProgrammingError, eng.execute,
- "show transaction isolation level")
+
+ if testing.db.driver == 'zxjdbc':
+ exception_cls = eng.dialect.dbapi.Error
+ else:
+ exception_cls = eng.dialect.dbapi.ProgrammingError
+ assert_raises(exception_cls, eng.execute, "show transaction isolation level")
class TimezoneTest(TestBase, AssertsExecutionResults):