Site icon R-bloggers

Situation

[This article was first published on HighlandR, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

You want to run a query over multiple tables in your database / warehouse and then process and visualise the combined results of those queries. You need to be able to switch between servers, databases, schemas and tables, selecting different columns and applying different conditions in the WHERE clause. You don’t have permsissions to write complex / dynamic SQL (for example you can’t create stored procedures or query system tables).

Are you stumped?

Not if you know R!

Here’s one way to do it..

  1. Set up a config file. This is a YAML file, where you store all the parameters, and possible values for each of those, in the order you want to loop through them.
  2. Write a SQL query using glue_SQL to allow for interpolating
To leave a comment for the author, please follow the link and comment on their blog: HighlandR.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.