Skip to content
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

str_extract fails - REGEXP_MATCH not found #369

Closed
jimmyg3g opened this issue Jan 30, 2020 · 1 comment
Closed

str_extract fails - REGEXP_MATCH not found #369

jimmyg3g opened this issue Jan 30, 2020 · 1 comment
Labels
dbplyr 🔧 feature a feature request or enhancement

Comments

@jimmyg3g
Copy link
Contributor

Using str_extract() with BigQuery throws this error: "Function not found: REGEXP_MATCH [invalidQuery]" BigQuery does not have a REGEXP_MATCH function, it does have REGEXP_CONTAINS

Here's a reprex:

con <- dbConnect(
  bigrquery::bigquery(), 
  project = 'bigquery-public-data', 
  dataset = 'austin_311', 
  billing = billing
)
d <- tbl(con, '311_service_requests')   
d %>%
  mutate(new_column = str_detect(complaint_description, 'Dog'))

It looks like the change to make is in the dplyr.R file's stringr equivalents. This has worked for me:

str_detect =  sql_prefix("REGEXP_CONTAINS", 2)

Cheers!

@hadley hadley added dbplyr 🔧 feature a feature request or enhancement labels May 1, 2020
@hadley
Copy link
Member

hadley commented May 1, 2020

Would you be interested in doing a PR?

jimmyg3g added a commit to jimmyg3g/bigrquery that referenced this issue May 5, 2020
@hadley hadley closed this as completed in 35a80ad May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dbplyr 🔧 feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants