我在使用blaze和odo将一些数据从MSSQL后端导出到csv时遇到了问题。
我要做的第一件事就是创建一个blaze.data对象,它使用dns连接和pyodbc作为驱动程序连接到MSSQL数据库。
adjustment_statuses是blaze.data对象连接到的数据库中的表。
然后我使用odo获取结果集并将其输出到csv。当我输出到json格式时,它按预期工作。我的预感是mssql支持作为odo后端存在一些问题。任何odo开发者都有这方面的见解吗?
ez = bz.data(EZ_DB)
result = ez.adjustment_statuses
odo(result, os.path.join(ETL_STAGING_LOC, 'ez_adjustment.csv'))
Traceback (most recent call last):
File "<input>", line 25, in <module>
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\odo\odo.py", line 91, in odo
return into(target, source, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\multipledispatch\dispatcher.py", line 164, in __call__
return func(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\blaze\interactive.py", line 406, in into
return into(a, result, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\multipledispatch\dispatcher.py", line 164, in __call__
return func(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\odo\into.py", line 43, in wrapped
return f(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\odo\into.py", line 143, in into_string
return into(a, b, dshape=dshape, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\multipledispatch\dispatcher.py", line 164, in __call__
return func(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\odo\into.py", line 43, in wrapped
return f(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\odo\into.py", line 131, in into_object
return append(target, source, dshape=dshape, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\multipledispatch\dispatcher.py", line 164, in __call__
return func(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\odo\backends\sql.py", line 808, in append_table_to_csv
conn.execute(stmt)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\engine\base.py", line 945, in execute
return meth(self, multiparams, params)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\sql\elements.py", line 263, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\engine\base.py", line 1046, in _execute_clauseelement
if not self.schema_for_object.is_default else None)
File "<string>", line 1, in <lambda>
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\sql\elements.py", line 436, in compile
return self._compiler(dialect, bind=bind, **kw)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\sql\elements.py", line 442, in _compiler
return dialect.statement_compiler(dialect, self, **kw)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\dialects\mssql\base.py", line 1107, in __init__
super(MSSQLCompiler, self).__init__(*args, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\sql\compiler.py", line 435, in __init__
Compiled.__init__(self, dialect, statement, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\sql\compiler.py", line 216, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\sql\compiler.py", line 242, in process
return obj._compiler_dispatch(self, **kwargs)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\ext\compiler.py", line 435, in <lambda>
lambda *arg, **kw: existing(*arg, **kw))
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\ext\compiler.py", line 474, in __call__
return fn(element, compiler, **kw)
File "C:\Users\jgenser\AppData\Local\Continuum\Anaconda2\envs\etl\lib\site-packages\sqlalchemy\ext\compiler.py", line 430, in _wrap_existing_dispatch
"compilation handler." % type(element))
CompileError: <class 'odo.backends.sql.CopyToCSV'> construct has no default compilation handler.