ValueError:字符U + 590048不在[U + 0000; U + 10ffff]-MAC OS [英] ValueError: character U+590048 is not in range [U+0000; U+10ffff] - MAC OS

查看:421
本文介绍了ValueError:字符U + 590048不在[U + 0000; U + 10ffff]-MAC OS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人从我的Python环境连接到Teradata时,有人可以帮助我解决以下错误.

Could someone help me with the below error while connecting to Teradata from my Python environment.

我正在使用ODBC驱动程序方法,并且尝试了以下所有现有方法进行连接,但是没有运气.

I'm using ODBC driver method and I've tried all the below existing methods to connect but no luck.

注意:如果您使用的是Windows,则可以直接使用这些方法,但是,如果您使用的是MAC OS,问题就来了(虽然不是全部)

Note: if you are using windows, you can directly use these methods, however the problem comes when you are on MAC OS (not for all though)

使用TERADATA模块和SQL炼金术.

USING TERADATA Module and SQL Alchemy.

import teradata
import pyodbc
server='111.00.00.00'
username = 'user'
password = 'pwd'   

udaExec = teradata.UdaExec(appName="test", version="1.0", 
logConsole=True)

ndw_con = udaExec.connect(method = 'odbc',authentication = "LDAP", 
system=server, username=username, password=password)

# SQL ALCHEMY from teradata 
from sqlalchemy import create_engine
user = 'user'
pwd = 'pwd'
host = '1'11.00.00.00'

td_engine = create_engine('teradata://'+user+':'+pwd+'@'+host+':22/' )

result = td_engine.execute('select top 100 * from temp.sampledata')

#使用PYODBC:下面的代码给了我一个新的错误,说('01000', [01000] [unixODBC] [驱动程序管理器]无法打开lib'Teradata':找不到文件 (0)(SQLDriverConnect))

# USING PYODBC: the below code gave me a new error saying ('01000', " [01000] [unixODBC][Driver Manager]Can't open lib 'Teradata' : file not found (0) (SQLDriverConnect)")

import pyodbc
td_conn = pyodbc.connect('DRIVER= . 
{Teradata};DBCName='+server+';UID='+username+';PWD='+ password, 
 automcommit=True)

cursor = td_conn.cursor()

无论如何,我都无法建立与Teradata的连接,有人可以让我知道这里发生了什么以及如何一劳永逸地解决此问题.

Regardless, I was unable to made a connection to teradata, could someone let me know what's going on here and how to fix this issue once for all.

谢谢!

推荐答案

使用pyodbc模块找到了答案.用驱动程序所在的完整路径替换了Driver = {Teradata}参数,请在fpr下面检查完整的连接字符串.请注意,这只能在MAC OS上使用.

Found the answer using pyodbc module. Replaced Driver = {Teradata} parameter with full path where the driver is located, check below fpr the full connection string. Please note that this can only be used on MAC OS.

td_conn = pyodbc.connect('DRIVER={/Library/Application Support/teradata/client/16.20/lib/tdataodbc_sbu.dylib};DBCName='+server+';UID='+username+';PWD='+ password, automcommit=True, authentication = "LDAP") 

这篇关于ValueError:字符U + 590048不在[U + 0000; U + 10ffff]-MAC OS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆