Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest fails sqlalchemy.exc.StatementError: (builtins.KeyError) 'object' for test query #25

Open
narendrans opened this issue Sep 14, 2022 · 1 comment
Assignees

Comments

@narendrans
Copy link
Owner

['UID=dremio', 'PWD=dremio123', 'HOST=localhost', 'PORT=32010', 'Schema=dremio', 'SSL=0']
['UID', 'dremio']
['PWD', 'dremio123']
['HOST', 'localhost']
['PORT', '32010']
['Schema', 'dremio']
['SSL', '0']
Traceback (most recent call last):
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1351, in _cursor_execute
    self.dialect.do_execute(cursor, statement, parameters, context)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
    cursor.execute(statement, parameters)
  File "/Users/naren/dev/sqlalchemy_dremio/sqlalchemy_dremio/db.py", line 30, in g
    return f(self, *args, **kwargs)
  File "/Users/naren/dev/sqlalchemy_dremio/sqlalchemy_dremio/db.py", line 149, in execute
    self._results, self.description = execute(
  File "/Users/naren/dev/sqlalchemy_dremio/sqlalchemy_dremio/query.py", line 68, in execute
    o = (x, _type_map[str(y.name)], None, None, True)
KeyError: 'object'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/naren/dev/sqlalchemy_dremio/test.py", line 9, in <module>
    result = engine.execute(sql)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2234, in execute
    connection = self._contextual_connect(close_with_result=True)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2302, in _contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
    return fn()
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 366, in connect
    return _ConnectionFairy._checkout(self, self._fairy)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
    rec = pool._do_get()
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 349, in _do_get
    c = self._create_connection()
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
    return _ConnectionRecord(self)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
    self.__connect(first_connect_check=True)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 664, in __connect
    pool.dispatch.first_connect.for_modify(
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/event/attr.py", line 314, in exec_once_unless_exception
    self._exec_once_impl(True, *args, **kw)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/event/attr.py", line 285, in _exec_once_impl
    self(*args, **kw)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/event/attr.py", line 322, in __call__
    fn(*args, **kw)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 1406, in go
    return once_fn(*arg, **kw)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/strategies.py", line 199, in first_connect
    dialect.initialize(c)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 330, in initialize
    self.returns_unicode_strings = self._check_unicode_returns(connection)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 433, in _check_unicode_returns
    results = {check_unicode(test) for test in tests}
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 433, in <setcomp>
    results = {check_unicode(test) for test in tests}
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 402, in check_unicode
    connection._cursor_execute(cursor, statement, parameters)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1353, in _cursor_execute
    self._handle_dbapi_exception(
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
    util.raise_(
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1351, in _cursor_execute
    self.dialect.do_execute(cursor, statement, parameters, context)
  File "/Users/naren/opt/anaconda3/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 608, in do_execute
    cursor.execute(statement, parameters)
  File "/Users/naren/dev/sqlalchemy_dremio/sqlalchemy_dremio/db.py", line 30, in g
    return f(self, *args, **kwargs)
  File "/Users/naren/dev/sqlalchemy_dremio/sqlalchemy_dremio/db.py", line 149, in execute
    self._results, self.description = execute(
  File "/Users/naren/dev/sqlalchemy_dremio/sqlalchemy_dremio/query.py", line 68, in execute
    o = (x, _type_map[str(y.name)], None, None, True)
sqlalchemy.exc.StatementError: (builtins.KeyError) 'object'
[SQL: SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1]```
@narendrans
Copy link
Owner Author

@jduo when running pytest and testing with superset encountered the above

narendrans pushed a commit that referenced this issue Sep 15, 2022
@narendrans narendrans self-assigned this Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant