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

"WITH alias as (...) SELECT" statements are generated for Mysql while mysql doesn't support them #1278

Closed
code-of-kpp opened this issue Oct 23, 2015 · 1 comment
Assignees
Milestone

Comments

@code-of-kpp
Copy link

Example

db = blaze.Data('mysql://...')
tb = db['my_table'][['field1', 'time', 'column']]

sel = tb[tb.field1 == 661]

sel.time.min()

Generated SQL:

WITH alias_25 AS 
(SELECT my_table.time AS time 
FROM my_table
WHERE my_table.field1 = %s)
 SELECT min(alias_25.time) AS time_min 
FROM alias_25

Error:

ProgrammingError: (_mysql_exceptions.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'alias_25 AS \n(SELECT my_table.time AS time \nFROM my_table' at line 1") [SQL: u'WITH alias_25 AS \n(SELECT my_table.time AS time \nFROM my_table \nWHERE my_table.field1 = %s)\n SELECT min(alias_25.time) AS time_min \nFROM alias_25'] [parameters: (661,)]
@code-of-kpp
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants