Skip to content

callproc and callfunc when using Oracle or other dbs and tests #907

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

Open
danizen opened this issue Jan 10, 2017 · 2 comments
Open

callproc and callfunc when using Oracle or other dbs and tests #907

danizen opened this issue Jan 10, 2017 · 2 comments

Comments

@danizen
Copy link

danizen commented Jan 10, 2017

Although the SQL panel has code to record procedure calls in the NormalCursorWrapper, there is no code to record function calls, e.g. cursor.callfunc. I also don't see any tests for callproc.

I'd like to contribute tests for callproc, and a wrapper implementation for callfunc that works and is tested, but I need some orientation - where is the SQL schema for tests? Is there anyway to use a "mock" database backend to implement this?

Thanks for any help...

@danizen
Copy link
Author

danizen commented Jan 11, 2017

So, now that I understand the design of the tests a bit better, my plan is to write a sub-class of the sqlite3 backend, which will handle mocking of callproc and callfunc, and allow these to be unit tested without a reliance on mock or unittest.mock.

I'm going to structure this as two pull requests - the first will implement callfunc, and I'll test it with an custom built Django app that integrates django-debug-toolbar.

The second pull request will implement the tests.

@danizen
Copy link
Author

danizen commented Feb 3, 2017

I still want them to show up, but I am no longer needing to "fix" django-debug-toolbar. I will tell our developers that the best practice is to use cursor.execute('SELECT funcname(...) FROM DUAL', params_dict) instead.

A test backend could be made that converts a callfunc() into a particular select, and a callproc() into a particular update. That way, we can see how they show up. But unless sqlparse supports these, it is hard to see how to proceed.

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