2

我在使用 blaze 和 odo 将一些数据从 MSSQL 后端导出到 csv 时遇到问题。

我要做的第一件事是创建一个 blaze.data 对象,该对象使用 dns 连接和 pyodbc 作为驱动程序连接到 MSSQL db。

adjust_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.
4

0 回答 0