-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
formatDateTime(datetime_field, '%Y-%m-%d %Hh') AS DateTime returns error #167
Comments
Hi. Following example works for me: In [1]: from clickhouse_driver import connect
In [2]: conn = connect('clickhouse://localhost')
In [3]: cur = conn.cursor()
In [4]: cur.execute("SELECT formatDateTime(now(), '%Y-%m-%d %Hh') AS DateTime")
In [5]: cur.fetchall()
Out[5]: [('2020-09-26 23h',)] Can you provide python snippet that reproduces your problem? |
Yes you are right. It wasn't a problem with clickhouse driver, it was a problem with jinjasql that had a problem with '%' character. After you have reported that select above works, I have done further investigation.
But the second one didn't:
Error was:
I found out that character '%' in select above should be escaped with another '%' character (as described on sripathikrishnan/jinjasql#28 (comment)) If second select is changed to:
everything works. I hope this will help to someone. |
Describe the bug
I have a table with DateTime field. If I am using DB API and:
I get an error
unsupported format character 'Y' (0x59) at index 380
Using the same select with pure Client works well.
I also noticed problems with select that use double or back quotes as field alias:
Double or back quote work with pure Client, but with DB API I get:
unsupported format character '"' (0x22) at index 262
unsupported format character '`' (0x60) at index 358
Versions:
clickhouse-driver-0.1.5
Python 3.7.4
The text was updated successfully, but these errors were encountered: