BigQuery error: No matching signature for operator >=
13,682
from brief glance - try below
a <- dbGetQuery(db,
paste0("select * from dta.tbl where col1='",
somevariable,"' and date>='",substr(gsub("\\D","",as.character(start.date)),3,8),
"' and date<='",substr(gsub("\\D","",as.character(end.date)),3,8), "'"))
Author by
user1111
Updated on June 27, 2022Comments
-
user1111 almost 2 years
I am getting an error
No matching signature for operator >= for argument types: STRING, INT64. Supported signatures: ANY >= ANY at [1:60]
when I run thisR
script to fetch some data fromBiqQuery
.This is where I get the error:
a <- dbGetQuery(db, paste0("select * from dta.tbl where col1='", somevariable"' and date>=",substr(gsub("\\D","",as.character(start.date)),3,8), " and date<=",substr(gsub("\\D","",as.character(end.date)),3,8)))
Any clue on how do I get rid of this error? I am using standardsql here
Thanks ahead! :)
-
user1111 about 6 yearsI am getting this error now
Error: unexpected string constant in: "paste0("select * from dta.tbl where col1='", somevariable"' and startdate>='"" Execution halted
-
user1111 about 6 yearsHi, thanks for your reply, but I am getting this error now
Error: unexpected string constant in: "paste0("select * from dta.tbl where col1='", somevariable"' and startdate>='"" Execution halted
-
Mikhail Berlyant about 6 yearsto troubleshoot your sql just print out your final string to see where you break the syntax :o)
-
user1111 about 6 yearsI am running it in cronjob, bit difficult to troubleshoot like that :(
-
Mikhail Berlyant about 6 yearsdoes not matter. if you know your data - you should/must - you can do it ("print" result) in your mind and see what is that executed! as an option - you can get to BQ UI and use recent queries to see what exactly query you are running
-
user1111 about 6 yearsIn BQ UI it says
Syntax error: Unclosed string literal at col1=' "
. But it doesn't seem to be unclosed everything seems to be closed well here -
Mikhail Berlyant about 6 yearssee my update - looks like you were missing one more comma -
somevariable
-
user1111 about 6 yearsHi Mikhail, It worked now :) I missed that comma after somevariable. Thank you so much for your quick help, Really helped me!!!
-
Mikhail Berlyant about 6 yearssure. whenever you get enough reputation score - come back and vote up on this answer :o)
-
user1111 about 6 yearsSure I will do that! :) I have one more same query: getting blind to find the same kind of error, if you could help me again, I will be obliged.
b <- dbGetQuery(db, paste0("select * from db1.tbl where date>=",paste0("20",substr(gsub("\\D","",as.character(start.date)),3,8)), " and date<=",paste0("20",substr(gsub("\\D","",as.character(end.date)),3,8))))
- getting the same error as above due to some quotes. -
Mikhail Berlyant about 6 yearsexactly same error for exactly same issue - you are missing quotes around your dates!
-
user1111 about 6 yearsYes was fixing that. :) You have an eye of an eagle btw. Thanks again!!!! I will come back to vote up your answer when I will be eligible for it. :)
-
Mikhail Berlyant about 6 yearsi am surprised a little with you changing your mind with regard of accepted answer - up to you of course - just surprised :o) any specific reason?
-
Elliott Brossard about 6 yearsNot sure why mine was accepted either. I posted before I saw that you had already answered with the same thing.
-
Mikhail Berlyant about 6 yearsno problem at all :o) just a little strange as he accepted already mine and then after many back and forth and additional questions - he finally changed this. as I said not a problem at all - just was curious :o)
-
user1111 about 6 yearsHi @MikhailBerlyant and Elliott - sorry about messing up checking the right accepted answer. Fixed it. It wasn't intentional. :) Thanks again for your help.