Skip to content

Commit

Permalink
debug(db_joins): Inspect ON query
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusSkytte committed Oct 15, 2024
1 parent e2daf77 commit c84dffa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/db_joins.R
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@ join_na_sql <- function(x, y, by = NULL, .dots = NULL) {
na_matching <- na_subquery |>
stringr::str_remove_all(stringr::fixed("\n")) |> # Remove newlines from the formatted query
stringr::str_replace_all(r"{\s{2,}}", " ") |> # Remove multiple spaces from the formatted query
stringr::str_extract(r"{(?<=ON \().*(?=\))}") |> # Extract the contents of the ON statement
stringr::str_extract(r"{(?<=ON \().*(?=\))}") # Extract the contents of the ON statement

print("ON subquery")
print(na_matching)

na_matching <- na_matching |>
stringr::str_extract(pattern = r"{(?:["'`]\s)([\w\s]+)(?:\s["'`])}", group = 1) # First non quoted word(s)
# Replace NA equals with NA matching statement
Expand Down

0 comments on commit c84dffa

Please sign in to comment.