turbodbc
turbodbc copied to clipboard
expose connection metadata
Hi,
The performance of turbodbc is great so I am building some internal db libs to do data loads, merges, etc.
It would really help to have access to connection metadata to handle cases where we need special handling for a specific DB. For example Sql Server can't handle python (or numpys/pandas) datetime precision so you have to format only to milliseconds.
Can you please expose some metadata, even just the original connection string?
Thanks!
Hi! Exposing some metadata should not be too much of a problem. As a workaround, you could attach metadata yourself, doing something like
my_arguments = {...}
connection = turbodbc.connect(**my_arguments)
connection.metadata = my_arguments
You might want to wrap that in a helper function that returns a connection with metadata.
Just chiming in to say that I use pyodbc to grab a lot of metadata, although it obviously wont get your connection string you used to connect with another library. You might be able to serve your needs by using pyodbc alongside turbodbc like I do
Thanks for the obvious solution that I completely missed! I was even thinking of creating a container object for the connection and anything else I want to track, but of course I can just add the metadata I want directly to the connection object. Clearly I've spent too many years with strongly-typed languages... :)
And yes I also use a mix of turbodbc, pyodbc, and sqlalchemy to perform various DB tasks. In this case however I just wanted metadata about the connection object itself, not from the DB it's connected to.
Cheers