Closed Bug 822179 Opened 13 years ago Closed 13 years ago

MySQL-compatible rendering of sqlalchemy query expressions

Categories

(Cloud Services Graveyard :: Server: Sync, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rfkelly, Unassigned)

Details

Attachments

(1 file)

The sync2.0 codebase does some fiddly things with sqlalchemy query expressions, including rendering them into a string so that we can add a /* queryName=BLAH */ comment to each query. I uncovered a problem in the current rendering logic, whereby it can sometimes render SQL syntax that is not valid for MySQL. To avoid this we need to use a backend-specific Dialect object when rendering the expression to a string. But this in turn can break other parts of the code, by mucking with the formatting of bind parameter names. The attached patch implements the best compromise I could find - use a backend-specific Dialect object, but force it to render bindparams in "named" format as expected by other parts of the code. It's pretty hacky...but that puts it in good company with the rest of the sqlalchemy-related code.
Attachment #692861 - Flags: review?(telliott)
Comment on attachment 692861 [details] [diff] [review] patch to use a backend-specific dialect when rendering queries This is horrible. I mean, it's fine, but the level of indirection we're hitting for relatively simple SQL just ensures we're going to have maintenance and comprehension issues in the long run :P
Attachment #692861 - Flags: review?(telliott) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Cloud Services → Cloud Services Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: