IMSMWU/RClickhouse

Unexpected behaviour with temporary tables

Closed this issue · 3 comments

First of all I am not sure if this is a problem with this library or the underlying c++ driver, which I suspect is the case.

I am creating temporary tables during the execution of a job, writing data and then copying it to the final table once I make sure that everything is fine.
The whole process is fine but the temporary tables are supposed to be deleted once I close the connection but the tables stay there, in the database I have specified with the connection, which is also odd as temporary tables aren´t supposed to have a database.
The remaining temporary tables are empty if I execute a count...

The query I use is:
CREATE TEMPORARY TABLE test_table_f55a142e4e164fc18ccaf0e2adf04b28 (...)
Executed as:
DBI::dbGetQuery(conn, query)

Thanks for your report! This package is just a wrapper around the c++ driver as you already mentioned. Therefore, I would suggest, that you report the issue there.

Well, I'm still facing the exact same issue.
Any luck with this?

@lucasxteixeira IMHO this is a CH "feature" and not directly related to our package. Temporary tables are merely an edge-case and may not follow the strategies followed in other databases (https://clickhouse.com/docs/en/sql-reference/statements/create/table#temporary-tables). As far as I know, temporary tables exist in memory till you delete them explicitly or the "session ends" (whatever that means). I suggest to simply add a drop table if exists statement at the end of your script.