I am relatively new to databases, performing SQL queries, etc. At the moment I am exclusively using MS SQL Server for my DBs (that's what we use at my work), but hopefully answers to my question can be more general than just for that particular DB.
I do a good chunk of my work using the DB interface app itself (in this case, SQL Server Management Studio), but I also do some work through python scripts, some of which run as cron jobs, some of which are websites such that users can submit queries into the DB.
I have been using the pymssql module for querying into & writing into DBs from python. But there are a few annoying problems that I'm running into. (It seems pymssql cannot use temporary tables, and also I've had troubles with "autocommit", but that's likely my own fault.)
So being ignorant to much of this, I'd just like a flavor of what direction I should go. As far as I can tell, I could either:
- use pymssql, which talks directly to the MS SQL servers
- use pyodbc, which requires installing FreeTDS & unixODBC first, and setting them up
- use adodbapi module, and I'm not sure what requirements are needed here.
- another method??
Thing is, I don't FULLY get what ODBC does. It seems like some sort of "authentification intermediary", sort of like a middle man to ensure that the user is who he / she says. And I have even less understanding of ADO.
While pymssql seems the easiest way to go, it also seems the one that folks think less highly of, and that it will eventually be deprecated. I'd rather learn the "right" way since I am pretty much just starting out with this stuff.
So I'm looking for some knowledgeable opinions regarding the best way to get python to talk to MS SQL Server, and to talk to DBs in general. I would define "best" as the best for someone who will do moderately complex stuff with it. (While I am just getting started, it's something that I'll eventually have to ramp up on quite a bit.)
Thanks! Mike