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

Field alias does not maintain case #54

Open
denniswambua opened this issue Feb 29, 2016 · 3 comments
Open

Field alias does not maintain case #54

denniswambua opened this issue Feb 29, 2016 · 3 comments

Comments

@denniswambua
Copy link

Created a field with camel casing
CountField(field="json->>'%s'" % unicode(column), alias="Count")]
The results comes with the count as all small letters.

[{'count': 7L, 'gender': u'male'}, {'count': 1L, 'gender': u'female'}]

Is there a way to maintain the casing as set in the alias property?

@denniswambua
Copy link
Author

This is a postgres thing, i got it working by passing alias with double quotes.
'"Count"'
Full example
CountField(field="json->>'%s'" % unicode(column), alias='"{}"'.format('Count'))]

Is there a better way to achieve this?

@somewes
Copy link
Contributor

somewes commented Feb 29, 2016

@denniswambua You are right, postgres will lower the case unless the alias is in double quotes. I'll update the project to automatically add double quotes around the alias so you don't have to manually do this.

@denniswambua
Copy link
Author

awesome that would be great

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

No branches or pull requests

2 participants