mvantellingen / psycopg2-ctypes

ctypes port of psycopg2 (see https://github.com/chtd/psycopg2cffi)
Other
56 stars 59 forks source link

(psycopg2.DataError) argument to option "encoding" must be a valid encoding name #33

Open user32000 opened 8 years ago

user32000 commented 8 years ago

Attempting to move a CSV with cyrillic (cp1251-encoded) text with odo.odo results in (psycopg2.DataError) argument to option "encoding" must be a valid encoding name when specifying the encoding as either 'cp1251', 'CP1251', 'WIN', or 'WIN1251'


DataError Traceback (most recent call last)

in () ----> 1 odo.odo('some_file.csv', 'postgresql://postgres:***@localhost/data::some_csv', sep=';', decimal=',', encoding='CP1251') /Applications/anaconda/lib/python2.7/site-packages/odo/odo.pyc in odo(source, target, *_kwargs) 88 odo.append.append - Add things onto existing things 89 """ ---> 90 return into(target, source, *_kwargs) /Applications/anaconda/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in **call**(self, _args, *_kwargs) 162 self._cache[types] = func 163 try: --> 164 return func(_args, *_kwargs) 165 166 except MDNotImplementedError: /Applications/anaconda/lib/python2.7/site-packages/odo/into.pyc in into_string_string(a, b, *_kwargs) 114 @into.register((type, (str, unicode)), (str, unicode)) 115 def into_string_string(a, b, *_kwargs): --> 116 return into(a, resource(b, *_kwargs), *_kwargs) 117 118 /Applications/anaconda/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in **call**(self, _args, *_kwargs) 162 self._cache[types] = func 163 try: --> 164 return func(_args, *_kwargs) 165 166 except MDNotImplementedError: /Applications/anaconda/lib/python2.7/site-packages/odo/into.pyc in into_string(uri, b, dshape, *_kwargs) 109 110 a = resource(uri, dshape=resource_ds, expected_dshape=dshape, *_kwargs) --> 111 return into(a, b, dshape=dshape, **kwargs) 112 113 /Applications/anaconda/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in **call**(self, _args, *_kwargs) 162 self._cache[types] = func 163 try: --> 164 return func(_args, *_kwargs) 165 166 except MDNotImplementedError: /Applications/anaconda/lib/python2.7/site-packages/odo/into.pyc in into_object(target, source, dshape, *_kwargs) 98 if dshape is None: 99 dshape = discover(source) --> 100 return append(target, source, dshape=dshape, *_kwargs) 101 102 /Applications/anaconda/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in **call**(self, _args, *_kwargs) 162 self._cache[types] = func 163 try: --> 164 return func(_args, *_kwargs) 165 166 except MDNotImplementedError: /Applications/anaconda/lib/python2.7/site-packages/odo/backends/sql_csv.pyc in append_csv_to_sql_table(tbl, csv, *_kwargs) 192 stmt = CopyFromCSV(tbl, csv, *_kwargs) 193 with tbl.bind.begin() as conn: --> 194 conn.execute(stmt) 195 return tbl /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in execute(self, object, _multiparams, *_params) 912 type(object)) 913 else: --> 914 return meth(self, multiparams, params) 915 916 def _execute_function(self, func, multiparams, params): /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/sql/elements.pyc in _execute_on_connection(self, connection, multiparams, params) 321 322 def _execute_on_connection(self, connection, multiparams, params): --> 323 return connection._execute_clauseelement(self, multiparams, params) 324 325 def unique_params(self, _optionaldict, *_kwargs): /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_clauseelement(self, elem, multiparams, params) 1008 compiled_sql, 1009 distilled_params, -> 1010 compiled_sql, distilled_params 1011 ) 1012 if self._has_events or self.engine._has_events: /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_context(self, dialect, constructor, statement, parameters, *args) 1144 parameters, 1145 cursor, -> 1146 context) 1147 1148 if self._has_events or self.engine._has_events: /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _handle_dbapi_exception(self, e, statement, parameters, cursor, context) 1339 util.raise_from_cause( 1340 sqlalchemy_exception, -> 1341 exc_info 1342 ) 1343 else: /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/util/compat.pyc in raise_from_cause(exception, exc_info) 197 exc_info = sys.exc_info() 198 exc_type, exc_value, exc_tb = exc_info --> 199 reraise(type(exception), exception, tb=exc_tb) 200 201 if py3k: /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_context(self, dialect, constructor, statement, parameters, *args) 1137 statement, 1138 parameters, -> 1139 context) 1140 except Exception as e: 1141 self._handle_dbapi_exception( /Applications/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/default.pyc in do_execute(self, cursor, statement, parameters, context) 448 449 def do_execute(self, cursor, statement, parameters, context=None): --> 450 cursor.execute(statement, parameters) 451 452 def do_execute_no_params(self, cursor, statement, context=None): DataError: (psycopg2.DataError) argument to option "encoding" must be a valid encoding name