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

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

Open
AlmightyOatmeal opened this issue Oct 20, 2022 · 1 comment

Comments

@AlmightyOatmeal
Copy link

AlmightyOatmeal commented Oct 20, 2022

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?

@ggshun
Copy link

ggshun commented Mar 15, 2023

It's once of those things where 6 months down the line I attempt to "clean" my code & switch from Select to SELECT and shit breaks

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

2 participants