Let the driver
be a DB-API driver (e.g., psycopg2
, pymysql
) and you can get the connection object via connnection = driver.connect(...)
. How do I check what kind of DBMS the connection object is connected to: (1) At best the DBMS name or (2) the module name.
Use Case:
I need to make special queries that are of different SQL syntax (e.g., COPY
clause for PostgreSQL vs using bulk INSERT
for MySQL).
Something like?:
Or shorter yet: