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

Getting error with sql include group_concat #76

Open
khorshidisamira opened this issue Jul 9, 2019 · 0 comments
Open

Getting error with sql include group_concat #76

khorshidisamira opened this issue Jul 9, 2019 · 0 comments

Comments

@khorshidisamira
Copy link

khorshidisamira commented Jul 9, 2019

I have a dataframe which has 2 columns, one is an id and another one is a string column. I want to group by the id and group_concat the string column but I am getting error:
qer = """SELECT ClaimID,group_concat(DiagnosisCodesseparator ',') asDiagnosisCodes` FROM headed GROUP BY ClaimID"""
queried = ps.sqldf(qer, locals())
Traceback (most recent call last):

File "", line 2, in
queried = ps.sqldf(qer, locals())

File "C:\ProgramData\Anaconda3\lib\site-packages\pandasql\sqldf.py", line 156, in sqldf
return PandaSQL(db_uri)(query, env)

File "C:\ProgramData\Anaconda3\lib\site-packages\pandasql\sqldf.py", line 63, in call
raise PandaSQLException(ex)

PandaSQLException: (sqlite3.OperationalError) near "separator": syntax error [SQL: "SELECT ClaimID,group_concat(DiagnosisCodes separator ',') as DiagnosisCodes FROM headed GROUP BY ClaimID"] (Background on this error at: http://sqlalche.me/e/e3q8)`
I tested the query in mysql and it's working there and when I remove the group_concat part, it's working in python as well.
Any solution to this issue is very welcome.

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

1 participant