Title: | Map 'SQL' Code to R Lists |
---|---|
Description: | Provides a helper function, to bulk read 'SQL' code from separate files and load it into an 'R' list, where the list elements contain the individual statements and queries as strings. This works by annotating the 'SQL' code with a name comment, which also will be the name of the list element. |
Authors: | Dejan Prvulovic [aut, cre] |
Maintainer: | Dejan Prvulovic <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-03-05 03:16:29 UTC |
Source: | https://github.com/dejse/sqlstrings |
Read all files from path and return a list, where the list elements contain the individual 'SQL' statements and queries as strings
generate_sql_strings(path = "")
generate_sql_strings(path = "")
path |
A path to a folder or a file containing 'SQL' code |
A list with named elements containing 'SQL' statements as strings
## prepare example file p <- fs::path(tempdir(), "test-file-001.sql") fs::file_create(p) readr::write_lines(" -- name: select_count select count(*) from tab1; ", p) ## sqlstrings s <- generate_sql_strings(path = p) s$select_count
## prepare example file p <- fs::path(tempdir(), "test-file-001.sql") fs::file_create(p) readr::write_lines(" -- name: select_count select count(*) from tab1; ", p) ## sqlstrings s <- generate_sql_strings(path = p) s$select_count