I'm trying to use sqlalchemy on Cygwin with a MSSQL backend but I cannot seem to get any of the MSSQL Python DB APIs installed on Cygwin. Is there one that is known to work?
FreeTDS + unixodbc + pyodbc stack will work on Unix-like systems and should therefore work just as well in Cygwin. You should use version 8.0 of TDS protocol. This can be configured in connection string.
Related
Is there a way to query a netezza database without explicitly installing its driver? I am using ubuntu 64 bit OS, our IT support says the driver they have only works on red hat systems.
If you can get your hands on the JDBC driver, you could use the Python, jaydebeapi module, with the driver to connect to the server. Note that there are a couple quirks involved. Namely things like boolean datatypes.
You can use pyodbc.
pyodbc is an open source Python module that makes accessing ODBC
databases simple. It implements the DB API 2.0 specification but is
packed with even more Pythonic convenience.
On Ubuntu systems, all you need to do is run
sudo apt install unixodbc-dev
before attempting
pip install pyodbc
See more details from Installing pyodbc.
I'm trying to read large amounts of data from Postgres on Linux via Python. SQL Alchemy is unacceptably slow. turbodbc https://github.com/blue-yonder/turbodbc bills itself as being fast, but seems to require an ODBC source, which is Windows, not Linux, AFAIK. (The Postgres FTP site has only .dlls for ODBC.) Yet, it claims Linux / Postgres compatibility.
How do I access Postgres on Linux via turbodbc or any other ODBC?
turbodbc works with PostgreSQL and Linux. This requires the packages unixodbc and odbc-postgresql to be installed. Then you need to set up a data source according to PostgreSQL's specifications.
The one issue here is that it won't be blazingly fast. Turbodbc is just an efficient way to communicate with the ODBC driver, basically exploiting bulk operations. However, the ODBC driver freely available for PostgreSQL itself is pretty slow. There is not much turbodbc can do about this.
I'd recommend psycopg2 or asyncpg (the latter requires Python 3.5, but is indeed very fast).
I'm trying to use python for manipulating some data in MySQL DB.
DB is on a remote PC. And I will use another PC with Python to connect to the DB.
When I searched how to install MySQLdb module to Python, they all said MySQL need to be installed on the local PC.
Is it right? Or I don't need to install MySQL on the local PC?
You just need it if you want to compile the Python MySQL bindings from source. If you already have the binary version of the python library then the answer is no, you don't need it.
I have a website on an Australian webhost. I have designed my website to allow people to login & their login details are stored in an SQLite3 database. I interact with the SQLite3 database using pythons SQLite3 module(found only in python2.5 & up)
My Problem: the webhost runs Python 2.4 so I cannot communicate with(query or modify) my SQLite3 database. The webhost will not allow me to install my own version of python or upload modules unless I upgrade to VPS.
What do you think are my options to still be able to work/interface with my SQL database? Do you know of way to interact with a SQL database using python modules from Python 2.4 or earlier?
Do you know of a python 2.4 module that will let me interact with an SQL database(can be MySQL, SQLite, etc.)?
There is a Python MySQL Module, called MySQLDB, which supports Python 2.3-2.7: http://sourceforge.net/projects/mysql-python/
The User Guide can be found here: http://mysql-python.sourceforge.net/MySQLdb.html
Check out pysqlite. It is the same module as in the newer python versions and I have used it no prob in 2.4 before.
What is the best way to access sql server from python is it DB-API ?
Also could someone provide a such code using the DB-API how to connect to sql server from python and excute query ?
See pyodbc - Python Database API Specification v2.0 implementation. Works great.
Additionally you can use it with other databases. If using with SQL Server 2008, make sure you use Native Driver if you need to support new DATE data types.
See pymssql It is a DB-API module for MS Sql Server and would be the most pythonic way. The documentation includes examples.
If on a Windows OS you could also use OLEDB through COM which will not require any thing else to be installed on the client.
Also if you use Iron Python you can use the .Net APIs
Also could someone provide a such code using the DB-API
how to connect to sql server from python and excute query ?
This hello world snippet pretty much shows you the common way how to connect with SQL server in Python with an DBI 2.0 database interface module.
Disclaimer: I'm the developer of pypyodbc
ODBC + freetds + a python wrapper library for ODBC.