-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
"Type DOUBLE does not exist" in Vertica database #3236
Comments
Hi @ablack3 , this is because there's no custom translation for Vertica, so A workaround is to add a |
Thank for the suggestions @edgararuiz. I'm an intermediate R programmer and don't much of a handle on methods and classes in R yet. I'm having trouble understanding the code in translate-sql-odbc.R. It looks like I'm interested in being able to extend this awesome package. Is there a higher level viewpoint I can start from so I can get an overall sense of how dplyr generates SQL and how to modify and extend it? Thanks! |
Hi, yes, we have a Translation page in our official site, here: http://db.rstudio.com/advanced/translation/ Happy to help further if there's anything else that would need clarification after that |
@edgararuiz Thanks for the helpful info.
|
Yes, you can use back ticks, see the MS SQL translation: https://github.com/tidyverse/dbplyr/blob/a424f67cee36a328cae9db77eea0443e4947a495/R/db-odbc-mssql.R#L2 |
OK type casting is working! Thanks! Now I would like to get the |
Right, that's a change that need to be submitted to the |
Oh I forgot, I believe that to test a custom translation without having to submit a PR or commit to a fork, you can create your own custom |
Hi Edgar, I'm having an issue with using the latest version of dbplyr on my Vertica database. I think the problem started when I updated to dbplyr 1.2.0 The problem is that this code
produces This gives me an error in the database because I can't select or group by an empty string. Any idea how to fix this? Great meeting you at the RStudio conference by the way. Thanks very much for your help and all of the amazing work you all are doing! -Adam |
Thanks @ablack3 ! And yes, I believe this is due an older issue in the I'd recommend upgrading that package to the latest version and try again. |
That worked like a charm. I'd really like to get the Is there any way to get |
Yes, you can create a custom The code should be a modified version of the base function, found here: https://github.com/tidyverse/dbplyr/blob/c0e51957a2fbeb4fe7bc93f0ed677d6d33e14828/R/dbi-s3.r#L55-L73 BTW - Would you mind posting that code once you get it working? We can re-use the code in |
I'm more than happy to post my code. dplyr + Vertica is a powerful combination that I'd like to get working well for myself and others. I appreciate your help so much, and anything I can do to contribute or give back I'd love to do. |
Ok I created two methods: |
Right, you can remove that step in your custom write and create tables? |
The call to A couple questions: How should I go about adding my code? Should I fork dbplyr, add a db-vertica.R file with my |
@edgararuiz can you please close the loop here? |
Sure. What I'll do is work on a PR for this, and ask if @ablack3 can test before marking as ready for review by you. |
@ablack3 - I just reread your last post, do you wish to submit a PR with your changes? If so, do you need any help through the process? You're right, you need to create a fork of the package in your repo, and make your changes, and submit a PR. |
This comment has been minimized.
This comment has been minimized.
@edgararuiz - I looked over my code again and I think there are still too many weird idiosyncrasies to be useful to the general population of dplyr users. With your help I have found workarounds for the issues I had initially, but I would need a better understanding of both dbplyr and Vertica to make them useful for others. The main issues were the creating a custom sql_translate_env for Vertica and getting Getting Someone with a much greater understanding of dplyr and Vertica than me created the vertica.dplyr package which presumably solved these problems and more. However it has not been updated and does not work with odbc. It uses the RODBC and RJDBC packages which I have not been able to get working. All that is to say that adding a Vertica support seems a bit more complicated than I initially thought. Perhaps someone else will update the vertica.dplyr package so that it works with odbc. I'll keep working on this as I have time but it is fine with me if you want to close the issue. Thanks again very much for your help! |
Ok, thanks @ablack3 for the follow up. It looks like that repo has not been touched in 2 yrs, so I'll see about addressing some of your findings in a PR. |
@edgararuiz can you please write up a summary of this thread in dbplyr issues, then close this issue? |
This issue was moved by batpigandme to tidyverse/dbplyr/issues/106. |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
I have an ODBC connection to a Vertica database and am using dplyr to query it.
Vertica has types DOUBLE PRECISION and NUMERIC but does not have type DOUBLE.
When I try to convert a variable of type CHARACTER to NUMERIC dplyr generates incorrect SQL code.
Unfortunately I cannot create a fully reproducible example because the issue involves a Vertica database connection.
CAST("myVar" AS DOUBLE)
This will not work since DOUBLE is not a valid type in Vertica.
DOUBLE PRECISION or NUMERIC should work.
I get the same issue when I use as.double()
CAST("myVar" AS DOUBLE)
However if I leave off the connection argument the correct SQL is generated
CAST("myVar" AS NUMERIC)
How do I fix this issue and get started adding support for Vertica?
Thanks!
The text was updated successfully, but these errors were encountered: