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 ran into issue when using DatabaseConnector in R (v4.4.2) to create tables. I am using the latest driver for Databricks (v2.7.1), Mac OS Somona 14.7.3. (chip: M3 Pro)
DatabaseConnector::dbExecute works fine when SQL statement does not involve built-in functions, e.g., UPPER, YEAR or any functions for regex. Please see example below.
dbExecute(conn,
" SELECT YEAR(start_date) AS start_year FROM my_table"
)
Example 2: dbExecute works if built-in function is not in use
dbExecute(conn,
" DROP TABLE IF EXISTS my_scratch.new_table; CREATE TABLE my_scratch.new_table AS SELECT start_date AS start_date FROM my_table"
)
Example 3: dbExecute fails if built-in function is call in SELECT
dbExecute(conn,
" DROP TABLE IF EXISTS my_scratch.new_table; CREATE TABLE my_scratch.new_table AS SELECT YEAR(start_date) AS start_year FROM my_table"
)
Using other built-in functions, e.g., UPPER can trigger the same error. Example 3 would work if a View is created instead.
The text was updated successfully, but these errors were encountered:
geoxc275
changed the title
DatabaseConnector issue of applying functions to SQL queries may related to database settings
DatabaseConnector issue of applying functions to SQL queries related to database settings
Feb 10, 2025
geoxc275
changed the title
DatabaseConnector issue of applying functions to SQL queries related to database settings
Cannot use built-in functions in SQL statement with DatabaseConnector
Feb 11, 2025
I ran into issue when using DatabaseConnector in R (v4.4.2) to create tables. I am using the latest driver for Databricks (v2.7.1), Mac OS Somona 14.7.3. (chip: M3 Pro)
DatabaseConnector::dbExecute
works fine when SQL statement does not involve built-in functions, e.g.,UPPER
,YEAR
or any functions for regex. Please see example below.Example 1:
dbExecute
works if no table is createdExample 2:
dbExecute
works if built-in function is not in useExample 3:
dbExecute
fails if built-in function is call inSELECT
The error message for example 3 is
Using other built-in functions, e.g.,
UPPER
can trigger the same error. Example 3 would work if aView
is created instead.The text was updated successfully, but these errors were encountered: