Python 谢谢,这很有用,但还有两件事:由于链接损坏,这些信息可能会丢失。此外,人们可能仍然有一个问题-除了所有值之外,第二个值的有效选项是什么?不幸的是,我不知道。在我的例子中,这些是我必须设置的值,这样它才能工作。其他价值观不起作用。从未找到除all之外的其他值

Python 谢谢,这很有用,但还有两件事:由于链接损坏,这些信息可能会丢失。此外,人们可能仍然有一个问题-除了所有值之外,第二个值的有效选项是什么?不幸的是,我不知道。在我的例子中,这些是我必须设置的值,这样它才能工作。其他价值观不起作用。从未找到除all之外的其他值,python,odbc,pyodbc,netezza,Python,Odbc,Pyodbc,Netezza,谢谢,这很有用,但还有两件事:由于链接损坏,这些信息可能会丢失。此外,人们可能仍然有一个问题-除了所有值之外,第二个值的有效选项是什么?不幸的是,我不知道。在我的例子中,这些是我必须设置的值,这样它才能工作。其他价值观不起作用。从未找到除all之外的其他值。@Koby该链接似乎不再损坏。找到这个 In [1]: import pyodbc In [2]: conn = pyodbc.connect(dsn='NZSQL') In [3]: curs = conn.cursor() In [4]:


谢谢,这很有用,但还有两件事:由于链接损坏,这些信息可能会丢失。此外,人们可能仍然有一个问题-除了所有值之外,第二个值的有效选项是什么?不幸的是,我不知道。在我的例子中,这些是我必须设置的值,这样它才能工作。其他价值观不起作用。从未找到除all之外的其他值。@Koby该链接似乎不再损坏。找到这个
In [1]: import pyodbc
In [2]: conn = pyodbc.connect(dsn='NZSQL')
In [3]: curs = conn.cursor()
In [4]: curs.execute("SELECT * FROM DB..FOO ORDER BY created_on DESC LIMIT 10")
Out[4]: <pyodbc.Cursor at 0x1a70ab0>

In [5]: curs.fetchall()
---------------------------------------------------------------------------
InvalidOperation                          Traceback (most recent call last)
<ipython-input-5-ad813e4432e9> in <module>()
----> 1 curs.fetchall()

/usr/lib/python2.7/decimal.pyc in __new__(cls, value, context)
    546                     context = getcontext()
    547                 return context._raise_error(ConversionSyntax,
--> 548                                 "Invalid literal for Decimal: %r" % value)
    549
    550             if m.group('sign') == "-":

/usr/lib/python2.7/decimal.pyc in _raise_error(self, condition, explanation, *args)
   3864         # Errors should only be risked on copies of the context
   3865         # self._ignored_flags = []
-> 3866         raise error(explanation)
   3867
   3868     def _ignore_all_flags(self):

InvalidOperation: Invalid literal for Decimal: u''
# Connect via pyodbc to listed data sources on machine
import pyodbc
print pyodbc.dataSources()

print "Connecting via ODBC"

# get a connection, if a connect cannot be made an exception will be raised here
conn = pyodbc.connect("DRIVER={NetezzaSQL};SERVER=<myserver>;PORT=<myport>;DATABASE=<mydbschema>;UID=<user>;PWD=<password>;")

print "Connected!\n"

# you can then use conn cursor to perform queries
SELECT
     foo::FLOAT AS was_numeric
     , bar::VARCHAR(255) AS was_nvarchar
UnicodeTranslationOption: Specify translation option for Unicode. Possible value strings are: utf8 : unicode data is in utf-8 encoding utf16 : unicode data is in utf-16 encoding utf32 : unicode data is in utf-32 encoding Do not add '-' in the value strings listed above, e.g. "utf-8" is not a valid string value. These value strings are case insensitive. On windows this option is not available as windows DM always passes unicode data in utf16. CharacterTranslationOption ("Optimize for ASCII character set" on Windows): Specify translation option for character encodings. Possible value strings are: all : Support all character encodings latin9 : Support Latin9 character encoding only Do not add '-' in the value strings listed above, e.g. "latin-9" is not a valid string value. These value strings are case insensitive. NPS uses the Latin9 character encoding for char and varchar datatypes. The character encoding on many Windows systems is similar, but not identical to this. For the ASCII subset (letters a-z, A-Z, numbers 0-9 and punctuation marks) they are identical. If your character data in CHAR or VARCHAR datatypes is only in this ASCII subset then it will be faster if this box is checked. If your data has special characters such as the Euro sign (€) then keep the box unchecked to accurately convert the encoding. Characters in the NCHAR or NVARCHAR data types will always be converted appropriately.