Case changes

19 views
Skip to first unread message

Marco44

unread,
Aug 25, 2010, 9:55:31 AM8/25/10
to sqlparse
Hi,

I'm feeling like I'm missing something, and that it must be obvious.

sqlformat uppercases everything in my queries (except strings in
single quotes). I didn't specify -i or -k options. Case is followed
when adding lower, upper. I'd like capitalization to stay as is.

By the way, I see another problem : strings between double quotes
shouldn't be capitalized (that's the real reason that the first
problem bothers me).

Great tool, by the way, I just need to solve these two problems for it
to be perfect for me :)


Cheers

Marc

Andi Albrecht

unread,
Aug 26, 2010, 9:30:22 AM8/26/10
to sqlp...@googlegroups.com
Marco44 <cousi...@gmail.com> writes:

> Hi,
>
> I'm feeling like I'm missing something, and that it must be obvious.
>
> sqlformat uppercases everything in my queries (except strings in
> single quotes). I didn't specify -i or -k options. Case is followed
> when adding lower, upper. I'd like capitalization to stay as is.

You've hit a bug! Thanks for reporting. Fixed in rev037b00400d.

>
> By the way, I see another problem : strings between double quotes
> shouldn't be capitalized (that's the real reason that the first
> problem bothers me).

Strings in double quotes are handled as identifiers in any case. Literal
strings (in SQL) are expected to be between single quotes. Which SQL
dialect are you using?

>
> Great tool, by the way, I just need to solve these two problems for it
> to be perfect for me :)

Thanks! That's good to hears :)


Regards,

Andi

>
>
> Cheers
>
> Marc

Marc Cousin

unread,
Aug 26, 2010, 9:41:15 AM8/26/10
to sqlp...@googlegroups.com
2010/8/26 Andi Albrecht <albrec...@googlemail.com>:
> Marco44 <cousi...@gmail.com> writes:

>> By the way, I see another problem : strings between double quotes
>> shouldn't be capitalized (that's the real reason that the first
>> problem bothers me).
>
> Strings in double quotes are handled as identifiers in any case. Literal
> strings (in SQL) are expected to be between single quotes. Which SQL
> dialect are you using?

Oracle, PostgreSQL, Firebird at least behave like this.

Double quotes are used at least in these to specify case sensitive
object names (and names with white spaces, or use reserved keywords as
object names).

Andi Albrecht

unread,
Aug 26, 2010, 1:46:00 PM8/26/10
to sqlp...@googlegroups.com
Marc Cousin <cousi...@gmail.com> writes:

You're right. I didn't thought of it this way. They are in quotes mainly
to be treated as is, of course. That's indeed another bug.

If you want to track progress please star this issue:
http://code.google.com/p/python-sqlparse/issues/detail?id=21

Thanks for clarifying!

Andi

Reply all
Reply to author
Forward
0 new messages