Skip to content

ERROR: ANALYZE is supported only with ODBC, JDBC, OLE-DB Prepared Statements #66

Description

@AlmightyOatmeal

I noticed that core.py has these few lines:

        if statement.find('select') == 0 or statement.find('SELECT') == 0 :
            statement = statement + " ANALYZE"
            self.execute(cursor, statement, None)

Which results in:

2022-10-20 13:26:00 CDT | INFO | sqlalchemy.engine.base.Engine._execute_context | select objid from _v_table where objid > 200000 and tablename = ? and schema = ?
2022-10-20 13:26:00 CDT | INFO | sqlalchemy.engine.base.Engine._execute_context | ('JAMIE_TEST', 'ADMIN')
2022-10-20 13:26:00 CDT | DEBUG | nzpy.Connection[<DB>].execute | Buffer sent to nps:bytearray(b'P\x00\x00\x00\nselect objid from _v_table where objid > 200000 and tablename = NULL and schema = NULL ANALYZE\x00')
2022-10-20 13:26:00 CDT | DEBUG | nzpy.Connection[<DB>].connNextResultSet | Backend response: b'E'
2022-10-20 13:26:00 CDT | DEBUG | nzpy.Connection[<DB>].connNextResultSet | Response received from backend:ERROR:  ANALYZE is supported only with ODBC, JDBC, OLE-DB Prepared Statements

Like, lol why? What's the purpose of throwing analyze in there? Why is the Connection.Prepare() method creating this statement and executing it only to return a query that is going to be executed? Why isn't there a check to see if it's an ODBC, JDBC, or OLE-DB connection prior to executing? Why is there no override to disable that type of silliness?

It's not like the results of ANALYZE are being parsed so what's the point?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions