-
Notifications
You must be signed in to change notification settings - Fork 178
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
Compute() with Oracle - missing keyword GLOBAL #621
Comments
This is issue is still happening for me using dbplyr v 2.1.1. Apologies if this is not the prefered place to raise this. Using dplyr/dbplr with this Oracle database is fantastic. So thank you. I've been long hoping to use compute() but do just fine most often without it. I'm just really wondering why it's not working for me. In terms of a reproducible example, this is a confidential database. So I hope this is descriptive enough to show that the error is still happening. I followed SamuelAllain's code and connect the same way using ROracle. Modifying his example some, this works for me.
And this does not.
I get the same error.
The trip object is a tbl_OraConnection to one of the tables I work with. I imagine the issue is on my end but any tips would be very much appreciated. I may also post in here. I posted a comment back in 2019 when the copy_to() suggestion didn't work for me. Thank you again for all your work on this package. |
Ah, I think we only added sql_query_save.OraConnection <- dbplyr::sql_query_save.Oracle |
Thank you for taking a look, mgirlich. I'm probably not doing it correctly, yet in trying to execute that code I get this error: I upgraded to dbplyr v. 2.1.1.9000 to see if that would help. It didn't. Searching the repository, I found that function and copied this code and ran it.
With the function in my Global Environment, I ran the I didn't expect that to work but perhaps it provides some clues. Thanks again, I appreciate it. |
Hi, I dig up an old thread about temporary tables in Oracle. I'm coming to the same point as @nilescbn : I can create a temporary table with DBMS side, the generated table is of type CREATE GLOBAL TEMPORARY TABLE TEMP_TABLE
AS SELECT * FROM DUAL;
SELECT * FROM TEMP_TABLE; The select query return 0 row. The table is type CREATE GLOBAL TEMPORARY TABLE TEMP_TABLE
ON COMMIT PRESERVE ROWS
AS SELECT * FROM DUAL;
SELECT * FROM TEMP_TABLE; The select query return 1 row as expected. Adding the Since version 18c, Oracle has implemented a second type of temporary table called All To summarize, in order to allow the creation of temporary tables in Oralce, it would be necessary to :
CREATE PRIVATE TEMPORARY TABLE "ORA$PTT_dbplyr_001"
ON COMMIT PRESERVE DEFINITION
AS (
SELECT * FROM DUAL
); From what I understand from the code of dbplyr, the change to be made concerns sql_query_save.Oracle <- function(con, sql, name, temporary = TRUE, ...) {
build_sql(
"CREATE ", if (temporary) sql("PRIVATE TEMPORARY "), "TABLE \n",
as.sql(name, con), if (temporary) sql(" ON COMMIT PRESERVE DEFINITION \n"), " AS\n", sql,
con = con
)
} I hope it will help! Environement:
|
Hi,
First of all, thank you for your work. I think there's a bug with the command
compute()
when used with Oracle connection.Returns this error
It's exactly the same that happens if you do
dbExecute(conn, 'CREATE TEMPORARY TABLE table_name(id NUMBER)')
instead ofdbExecute(conn, 'CREATE GLOBAL TEMPORARY TABLE table_name(id NUMBER)')
which works fine. See other people concerned.The text was updated successfully, but these errors were encountered: