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

Unexpected message: RowDescription #536

Closed
nicolaerosia opened this issue Nov 9, 2023 · 7 comments · Fixed by #538
Closed

Unexpected message: RowDescription #536

nicolaerosia opened this issue Nov 9, 2023 · 7 comments · Fixed by #538
Labels

Comments

@nicolaerosia
Copy link

Anyone saw this before?

    sql_con.execute(insert_stmt, records)
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/future/engine.py", line 280, in execute
    return self._execute_20(
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
    return connection._execute_clauseelement(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
    ret = self._execute_context(
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
    util.raise_(
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1890, in _execute_context
    self.dialect.do_executemany(
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 733, in do_executemany
    cursor.executemany(statement, parameters)
  File "/usr/local/lib/python3.11/site-packages/vertica_python/vertica/cursor.py", line 185, in wrap
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/vertica_python/vertica/cursor.py", line 319, in executemany
    self.copy(copy_statement, data)
  File "/usr/local/lib/python3.11/site-packages/vertica_python/vertica/cursor.py", line 507, in copy
    raise errors.MessageError('Unexpected message: {0}'.format(message))
sqlalchemy.exc.InternalError: (vertica_python.errors.MessageError) Unexpected message: RowDescription: [
Column(name=OUTPUT, data_type_oid=6, data_type_name=Integer, schema_name=None, table_name=None, table_oid=0, attribute_number=0, precision=None, scale=None, null_ok=True, is_identity=False, format_code=1, internal_size=8, display_size=20)]
@sitingren
Copy link
Member

@nicolaerosia Would you please provide the Vertica server version, vertica-python version and a reproducer program?

@nicolaerosia
Copy link
Author

nicolaerosia commented Nov 13, 2023

@sitingren hello

Unfortunately I cannot reproduce, it only happens from time to time.

Vertica version: Vertica Analytic Database v11.1.1-8
vertica-python: 1.3.5 <- I can try 1.3.6 if you think that will help

@nicolaerosia
Copy link
Author

I'm using sqlalchemy on top,

    insert_stmt = sqlalchemy.insert(MyTable).inline()
    records = df.to_dict(orient="records")
    sql_con.execute(insert_stmt, records)

Maybe it's related to .inline() ?

@sitingren
Copy link
Member

@nicolaerosia I cannot reproduce with just 3 lines of code. Can you provide a full sqlalchemy program with the definition of MyTable and sample data in df?

@nicolaerosia
Copy link
Author

thanks a lot @sitingren , will give it a try :)

As I said, I don't have a reproducer, it happens sporadically.

@sitingren
Copy link
Member

There are multiple cases that can trigger Unexpected message: RowDescription error. I don't know which case your sqlalchemy program belongs too. I add improvement in #538 to cover some cases.

@nicolaerosia
Copy link
Author

@sitingren I think I found the pattern.

I'm using celery, and sometimes the task takes too much and celery kills the task.
It may be the case that the executing task was in the middle of a SQL Query, then it gets interrupted.

The next task comes, it reuses the previous connection, and it gets unexpected message, the response from previous query?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants