You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
The below SQL snippet should behave similar to concat but it throws some weird exception. Please correct me if I am misunderstanding the usage here. Thanks !
Reproducible example
importpolarsaspldf_test=pl.DataFrame(
{
"group": ['a'],
"attr": [1]
}
)
df_test2=pl.DataFrame(
{
"group": ['b'],
"attr": [2]
}
)
sql_ctx=pl.SQLContext()
sql_ctx.register("test", df_test.lazy())
sql_ctx.register("test2", df_test2.lazy())
result=sql_ctx.query("""SELECT * FROM testUNIONSELECT * FROM test2""")
print(result)
# Output---------------------------------------------------------------------------ComputeErrorTraceback (mostrecentcalllast)
CellIn[17], line2018sql_ctx.register("test", df_test.lazy())
19sql_ctx.register("test2", df_test2.lazy())
--->20result=sql_ctx.query(""" 21 SELECT * FROM test 22 UNION 23 SELECT * FROM test2 24 """)
25# result = pl.concat((df_test, df_test2))26print(result)
File~/Library/Caches/pypoetry/virtualenvs/cseg-UL-1613v-py3.9/lib/python3.9/site-packages/polars/sql/context.py:56, inSQLContext.query(self, query)
55defquery(self, query: str) ->DataFrame:
--->56returnself.execute(query).collect()
File~/Library/Caches/pypoetry/virtualenvs/cseg-UL-1613v-py3.9/lib/python3.9/site-packages/polars/sql/context.py:53, inSQLContext.execute(self, query)
43defexecute(self, query: str) ->LazyFrame:
44""" 45 Parse the givens SQL query and transform that to a ``LazyFrame``. 46 (...) 51 52 """--->53returnwrap_ldf(self._ctxt.execute(query))
ComputeError: INSERT, UPDATEisnotsupported
UNION and UNION ALL are (more or less) equivalent operations as far as the SQL parsing/translation is concerned; we don't support either yet, though I may take a look at UNION to see how much work it is...🤔
Polars version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
The below SQL snippet should behave similar to
concat
but it throws some weird exception. Please correct me if I am misunderstanding the usage here. Thanks !Reproducible example
Expected behavior
Installed versions
The text was updated successfully, but these errors were encountered: