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

Drop Scratch Tables Missing tempEmulationSchema #777

Open
katy-sadowski opened this issue Dec 19, 2024 · 0 comments
Open

Drop Scratch Tables Missing tempEmulationSchema #777

katy-sadowski opened this issue Dec 19, 2024 · 0 comments

Comments

@katy-sadowski
Copy link

katy-sadowski commented Dec 19, 2024

Achilles/R/Achilles.R

Lines 796 to 803 in 247b86d

if (numThreads == 1 || scratchDatabaseSchema == "#") {
numThreads <- 1
if (.supportsTempTables(connectionDetails) && connectionDetails$dbms != "oracle") {
scratchDatabaseSchema <- "#"
schemaDelim <- "s_"
}
}

Achilles/R/Achilles.R

Lines 826 to 830 in 247b86d

dropSqls <- lapply(c(resultsTables, resultsDistTables), function(scratchTable) {
sql <- SqlRender::render("IF OBJECT_ID('@scratchDatabaseSchema@schemaDelim@scratchTable', 'U') IS NOT NULL DROP TABLE @scratchDatabaseSchema@schemaDelim@scratchTable;",
scratchDatabaseSchema = scratchDatabaseSchema, schemaDelim = schemaDelim, scratchTable = scratchTable)
sql <- SqlRender::translate(sql = sql, targetDialect = connectionDetails$dbms)
})

I just ran ACHILLES on Snowflake in single-threaded mode and it failed to drop the scratch tables with this sort of error for every scratch table: 2024-12-19 07:13:39 [Main thread] ERROR Achilles 3 Drop Achilles Scratch Table -- ERROR ([1m[33mError[39m in .createErrorReport():[22m [33m![39m Error executing SQL: net.snowflake.client.jdbc.SnowflakeSQLException: Cannot perform DROP. This session does not have a current schema. Call 'USE SCHEMA', or use a qualified name.

Indeed, I can see in the linked code above and the SQL error report that the tempDatabaseSchema is not being appended (after scratchDatabaseSchema is hardcoded to "#"): DROP TABLE IF EXISTS lxw8zrjfs_tmpach_dist_2106

I have not experienced this issue when running in multi-threaded mode. I'm on v1.7.2 of ACHILLES.

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