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

add some examples to the docs around creating views and tables from orbital object #74

Open
EmilHvitfeldt opened this issue Dec 18, 2024 · 0 comments
Milestone

Comments

@EmilHvitfeldt
Copy link
Member

# Add predictions column to table
res <- dplyr::mutate(lendingclub_dat, !!!orbital_inline(orbital_obj))

# Select only the prediction column and the ID column
pred_name <- ".pred"
res <- dplyr::select(res, dplyr::any_of(c("ID", pred_name)))

# Translate the dbplyr `tbl` into a SQL query string
generated_sql <- remote_query(res)

versioned_view_name <- 
  glue("{model_name}_v{model_version}")

snowflake_view_statement <-
  glue::glue_sql("CREATE OR REPLACE VIEW {`versioned_view_name`} AS ",
                 generated_sql,
                 .con = con)

# NOTE: Uncomment the following line to see the whole Snowflake View creation statement.
# snowflake_view_statement
@EmilHvitfeldt EmilHvitfeldt added this to the 0.3.0 milestone Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant