I am using python 3.x and unix for accessing teradata. I am totally new to teradata and python. I could easily connect to oracle with python but for teradata there is this no driver issue coming. I will not be able to do any unix side installations due to company policy. Can you please suggest ant work around where i can connect to the teradata using python without any drivers, i know i may sound foolish, but thats what my situation is. TIA
As Fred said, Teradata offers a Teradata SQL Driver for Python.
Here is a link to the documentation: https://github.com/Teradata/python-driver
Install the driver with: pip install teradatasql
Related
I want to connect to Teradata Aster, I have been searched through multiple sites and read documentation but with not luck. I am able to connect to Teradata just fine, but not to Aster Teradata.
code for teradata that works, but I don't know how to tweak this to work for aster:
import teradata
udaExec = teradata.UdaExec(appName="", version="1.0", logConsole=False)
session = udaExec.connect(method="odbc", system="TDD...", username="...", password="...", authentication="LDAP");
To connect to Aster use native Teradata Aster ODBC driver. Follow this link and choose "Aster Client Tools" for your platform to find and download the driver.
Then use a Python package for ODBC database connectivity such as pyodbc. I used similar method in R but never with Python, one example I found for Python and Teradata is here.
I have 2 machines setup:
RDP terminal with timesten client 11.2.1 and pyodbc==3.0.7 and works great. I use this connection string:
cnxn = pyodbc.connect('DSN=myhostip;UID=myusername;PWD=mypass')
local machine with timesten client 11.2.2 and pyodbc==4.0.22 (I've also tried older versions, like 3.0.7)
and when I use the connection string:
cnxn = pyodbc.connect('DSN=myhostip1;UID=myusername1;PWD=mypass1')
I get this error:
pyodbc.Error: ('HY010', u'[HY010] [Microsoft][ODBC Driver Manager] The driver is incapable of supporting the current environment attributes. (0) (SQLDriverConnect)').
Both databases on both machines are practically the same, so difference is only in timesten driver version.
Or what else could be the problem?
I have set up DSNs on both machines, and I connect to them in SQLDeveloper.
I've tried different timesten clients and pyodbc versions, but got same error everytime.
It's the only way that I know of to connect to timesten DB, can anyone please help me solve this error, or maybe tell about another way,except pyodbc, to connect?
See this answer on how to connect to TimesTen via Python:
python access to TimesTen
Use cx_Oracle via tnsnames.ora as this is the method that Oracle will support in TimesTen 18.1.3
Please avoid using any ODBC based method to connect to Python as none of these techniques are developed or tested by Oracle.
Is there a way for python to connect to MS SQL Server using Windows Authentication, even when not running the python app on a windows box?
I'm trying to do this with pymssql, but the examples mostly seem to assume that you're running on windows.
If there is a way to make this connection using some other library, please feel free to suggest, but I do like how pymssql is simple to install and deploy via pip.
I want to connect to 2005/2008 databases, and I'm running Ubuntu 13.04 (but I can upgrade to a later Ubuntu if it makes a difference)
SOLUTION:
It turns out that pymssql can connect to my database via my windows username and password. But to do so, I need to pass the actual username/password like this:
pymssql.connect(host, 'THEDOMAIN\\theusername', 'thepassword', db)
The solution EkoostikMartin provided is still good though (if you do not want to store a password somewhere, which is probably the point to windows auth anyway)
You can use the SQL Server ODBC driver for linux, and set up Kerberos.
See this article - http://technet.microsoft.com/en-us/library/hh568450.aspx
I'm trying to install MYSQLdb on a windows client. The goal is, from the Windows client, run a python script that connects to a MySQL server on a LINUX client. Looking at the setup code (and based on the errors I am getting when I try to run setup.py for mysqldb, it appears that I have to have my own version of MySQL on the windows box. Is there a way (perhaps another module) that will let me accomplish this? I need to have people on multiple boxes run a script that will interact with a MySQL database on a central server.
you could use a pure python implementation of the mysql client like
pymysql
(can be used as a dropin-replacement for MySQLdb by calling pymysql.install_as_MySQLdb())
MySql-Connector
You don't need the entire MySQL database server, only the MySQL client libraries.
It's been a long time since I wrote python db code for windows...but I think something like this should still work.
If you're running the client only on windows machines, install the pywin32 package. This should have an odbc module in it.
Using the windows control / management tools, create an odbc entry for either the user or the system. In that entry, you'll give the connection parameter set a unique name, then select the driver (in this case MySQL), and populate the connection parameters (e.g. host name, etc.) See PyWin32 Documentation for some notes on the odbc module in pywin32.
Also, see this post: Common ways to connect to odbc from python on windows.
Can anyone point me to a "free" resource that allows one to connect via pyodbc to an Oracle database? We have a multi db environment we support. I have DB2 and MSSQL ODBC drivers working but I cannot seem to find any information on connecting via ODBC/pyodbc to an Oracle server running on Linux.
Linux: cat /etc/redhat-release
CentOS release 5.5 (Final)
Python: python -V
Python 2.4.3
I found a few links to some thing call mxODBC but it appears to be a closed, commercial ($$$) solution.
Not knowing thing one about pyodbc, I have to ask: would the oracle ODBC driver in the instant client software help you out? That's free.