Merge lp:~therve/storm/delete-with-using into lp:storm
Proposed by
Thomas Herve
Status: | Work in progress |
---|---|
Proposed branch: | lp:~therve/storm/delete-with-using |
Merge into: | lp:storm |
Diff against target: |
153 lines (+85/-7) 4 files modified
storm/databases/mysql.py (+27/-3) storm/databases/postgres.py (+30/-4) storm/expr.py (+1/-0) tests/store/base.py (+27/-0) |
To merge this branch: | bzr merge lp:~therve/storm/delete-with-using |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Henstridge | Needs Fixing | ||
Storm Developers | Pending | ||
Review via email: mp+40785@code.launchpad.net |
Description of the change
I think I'm happy enough with the branch. I added support to MySQL and Postgres, and it looks simple enough.
To post a comment you must log in.
Unmerged revisions
- 359. By Thomas Herve
-
Fix tests naming
- 358. By Thomas Herve
-
Cleanup
- 357. By Thomas Herve
-
Add one test with 3 tables
- 356. By Thomas Herve
-
Use localized compile, add support for mysql
- 355. By Thomas Herve
-
Merge forward
- 354. By Thomas Herve
-
Support USING in DELETE
I notice that you don't do a state.push/pop on auto_tables like compile_select() does. I guess it isn't as important since DELETE statements can't be nested (can they?), but it wouldn't hurt.
Also, the use of build_tables() and manually adding tables from state.auto_tables looks fishy. For compile_select() the automatically generated table list comes from build_tables, so I think there is a problem with how it is being used here.
I think the way it should work is:
1. just run compile() on Delete.table to generate the "FROM xxx" clause. compile, Undef, Undef, state) to generate the "USING xxx" clause,
2. use build_tables(
plus some way to ensure Delete.table does not appear in this list.
Now on to the test changes: While we've used the "if cls_name. startswith( ...):" pattern to disable tests for some backends, perhaps it would be cleaner to add a "supports_ delete_ using() " method that the backend test classes can override to say whether the test should run.
Lastly, it would be good to include a test for the case where the backend does not support "DELETE ... USING" to ensure we give a sensible error rather than generating nonsense SQL like we currently do.