-
Notifications
You must be signed in to change notification settings - Fork 174
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
copy_inline
does not work for HANA DB.
#950
Comments
Would be great help if you could provide an example with the correct syntax. |
It seems to me that HANA DB doesn't allow the VALUES clause in a SELECT statement. An alternative possibility, not very elegant, but which executes without errors: SELECT CAST("a" AS DOUBLE) AS "a", CAST("b" AS DOUBLE) AS "b"
FROM (
SELECT 1 AS "a", 2 AS "b" FROM dummy
UNION ALL
SELECT 1 AS "a", 3 AS "b" FROM dummy
-- ...
-- attach as many UNION ALL as there are rows
) |
Okay, so this is the same issue as in #949 just for a different database. |
Is it standard though? I would be interested in your references in case you know better. Thanks! |
@lschneiderbauer is the sql generated to fix this issue on redshift (#961 (comment)) also valid for hana db? It appears it is given your comment above, but I don't have access to a hana db to test for sure. |
@lschneiderbauer Would be great if you could test out my implementation (install via |
@mgirlich I just tested it, and it executes fine! copy_inline(con, tibble(a=c(1,1,1,2,3,4), b=c(2,3,3,4,5,3))) %>% show_query() <SQL>
SELECT CAST("a" AS DOUBLE) AS "a", CAST("b" AS DOUBLE) AS "b"
FROM (
(
SELECT NULL AS "a", NULL AS "b"
FROM "DUMMY"
WHERE (0 = 1)
)
UNION ALL
(
SELECT 1.0, 2.0 FROM DUMMY UNION ALL
SELECT 1.0, 3.0 FROM DUMMY UNION ALL
SELECT 1.0, 3.0 FROM DUMMY UNION ALL
SELECT 2.0, 4.0 FROM DUMMY UNION ALL
SELECT 3.0, 5.0 FROM DUMMY UNION ALL
SELECT 4.0, 3.0 FROM DUMMY
)
) "values_table" Output of copy_inline(con, tibble(a=c(1,1,1,2,3,4), b=c(2,3,3,4,5,3))) -> # Source: SQL [6 x 2]
# Database: HDB ******
a b
<dbl> <dbl>
1 1 2
2 1 3
3 1 3
4 2 4
5 3 5
6 4 3 Thanks! |
Hi,
thanks a lot for implementing the extremely useful
copy_inline
method.Unfortunately, the generated SQL fails for HANA DB.
I cannot create a reprex since it requires a real ocdb connection.
But here is the code:
The SQL it generates:
The text was updated successfully, but these errors were encountered: