diff --git a/dev/53/articles/connector.html b/dev/53/articles/connector.html index 5ad0548..eb56454 100644 --- a/dev/53/articles/connector.html +++ b/dev/53/articles/connector.html @@ -341,12 +341,12 @@

Working example#> Connection to: #> → adam #> connector_fs -#> /tmp/Rtmptg6cNO/adam +#> /tmp/RtmpWsRGfM/adam #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → tfl #> connector_fs -#> /tmp/Rtmptg6cNO/tfl +#> /tmp/RtmpWsRGfM/tfl ## Iris data setosa <- iris |> diff --git a/dev/53/articles/customize.html b/dev/53/articles/customize.html index b0c5bee..e55a33b 100644 --- a/dev/53/articles/customize.html +++ b/dev/53/articles/customize.html @@ -95,9 +95,12 @@

Creating a new connector#> <connector_myclass> #> Inherits from: <connector>

This is the simplest type of inheritance, and you should note that -the connector parent class has no methods for e.g. reading -(read_cnt()) or writing (write_cnt()) -data.

+the connector parent class has no methods capable of +e.g. reading (read_cnt()) or writing +(write_cnt()) data. It only has default methods that throws +meaningful errors if you have not defined the method +(e.g. write_cnt.my_class()) for your new connector +class.

In most cases you want to inherit from either connector_fs() or connector_dbi() depending on if your new connector is used to access files or databases @@ -192,7 +195,7 @@

Create custom generic method#> { #> UseMethod("list_content_cnt") #> } -#> <bytecode: 0x555fb00c8b50> +#> <bytecode: 0x564ba57a7b50> #> <environment: namespace:connector> # List the registered s3 methods diff --git a/dev/53/pkgdown.yml b/dev/53/pkgdown.yml index 4fba1cf..ae485b9 100644 --- a/dev/53/pkgdown.yml +++ b/dev/53/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: connector: connector.html customize: customize.html -last_built: 2024-12-05T09:52Z +last_built: 2024-12-05T10:13Z urls: reference: https://novonordisk-opensource.github.io/connector/reference article: https://novonordisk-opensource.github.io/connector/articles diff --git a/dev/53/reference/connector_fs.html b/dev/53/reference/connector_fs.html index b69f3c9..2c24c98 100644 --- a/dev/53/reference/connector_fs.html +++ b/dev/53/reference/connector_fs.html @@ -242,17 +242,17 @@

Examples#> `upload_cnt.connector_fs()` #> `write_cnt.connector_fs()` #> Specifications: -#> path: /tmp/Rtmp704dnN +#> path: /tmp/RtmptTicCA # List content cnt$list_content_cnt() #> [1] "bslib-60b44f9663e91341c79e0df466adbe7c" #> [2] "downlit" -#> [3] "file18593ff5caa7" -#> [4] "file185947472f0b" -#> [5] "file18597e232188" -#> [6] "file18597ed13f7f" +#> [3] "file183213b6b282" +#> [4] "file1832182185e7" +#> [5] "file18327abc6b5f" +#> [6] "file1832879294d" #> [7] "repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds" # Write to the connector @@ -264,10 +264,10 @@

Examplescnt$list_content_cnt() #> [1] "bslib-60b44f9663e91341c79e0df466adbe7c" #> [2] "downlit" -#> [3] "file18593ff5caa7" -#> [4] "file185947472f0b" -#> [5] "file18597e232188" -#> [6] "file18597ed13f7f" +#> [3] "file183213b6b282" +#> [4] "file1832182185e7" +#> [5] "file18327abc6b5f" +#> [6] "file1832879294d" #> [7] "iris.rds" #> [8] "repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds" diff --git a/dev/53/reference/connectors.html b/dev/53/reference/connectors.html index f6027ba..f53238a 100644 --- a/dev/53/reference/connectors.html +++ b/dev/53/reference/connectors.html @@ -89,7 +89,7 @@

Examples#> `upload_cnt.connector_fs()` #> `write_cnt.connector_fs()` #> Specifications: -#> path: /tmp/Rtmp704dnN +#> path: /tmp/RtmptTicCA con$adam #> <connector_dbi> diff --git a/dev/53/reference/list_content_cnt.html b/dev/53/reference/list_content_cnt.html index d68696c..eee8da5 100644 --- a/dev/53/reference/list_content_cnt.html +++ b/dev/53/reference/list_content_cnt.html @@ -103,11 +103,11 @@

Examples list_content_cnt() #> [1] "bslib-60b44f9663e91341c79e0df466adbe7c" #> [2] "downlit" -#> [3] "file18593ff5caa7" -#> [4] "file185947472f0b" -#> [5] "file185958887b1f" -#> [6] "file18597e232188" -#> [7] "file18597ed13f7f" +#> [3] "file183213b6b282" +#> [4] "file1832182185e7" +#> [5] "file18323c075c3d" +#> [6] "file18327abc6b5f" +#> [7] "file1832879294d" #> [8] "iris.rds" #> [9] "repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds" diff --git a/dev/53/reference/write_cnt.html b/dev/53/reference/write_cnt.html index ea221e6..62afe7e 100644 --- a/dev/53/reference/write_cnt.html +++ b/dev/53/reference/write_cnt.html @@ -122,7 +122,7 @@

Examples cnt |> list_content_cnt(pattern = "iris") -#> [1] "iris.csv" "iris.rds" "iris185958354759.csv" +#> [1] "iris.csv" "iris.rds" "iris18322950d6e9.csv" # rds file cnt |> @@ -134,7 +134,7 @@

Examples cnt |> list_content_cnt(pattern = "iris") -#> [1] "iris.csv" "iris.rds" "iris185958354759.csv" +#> [1] "iris.csv" "iris.rds" "iris18322950d6e9.csv" diff --git a/dev/53/search.json b/dev/53/search.json index 0217ff6..6c9b895 100644 --- a/dev/53/search.json +++ b/dev/53/search.json @@ -1 +1 @@ -[{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"Apache License","title":"Apache License","text":"Version 2.0, January 2004 ","code":""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_1-definitions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"1. Definitions","title":"Apache License","text":"“License” shall mean terms conditions use, reproduction, distribution defined Sections 1 9 document. “Licensor” shall mean copyright owner entity authorized copyright owner granting License. “Legal Entity” shall mean union acting entity entities control, controlled , common control entity. purposes definition, “control” means () power, direct indirect, cause direction management entity, whether contract otherwise, (ii) ownership fifty percent (50%) outstanding shares, (iii) beneficial ownership entity. “” (“”) shall mean individual Legal Entity exercising permissions granted License. “Source” form shall mean preferred form making modifications, including limited software source code, documentation source, configuration files. “Object” form shall mean form resulting mechanical transformation translation Source form, including limited compiled object code, generated documentation, conversions media types. “Work” shall mean work authorship, whether Source Object form, made available License, indicated copyright notice included attached work (example provided Appendix ). “Derivative Works” shall mean work, whether Source Object form, based (derived ) Work editorial revisions, annotations, elaborations, modifications represent, whole, original work authorship. purposes License, Derivative Works shall include works remain separable , merely link (bind name) interfaces , Work Derivative Works thereof. “Contribution” shall mean work authorship, including original version Work modifications additions Work Derivative Works thereof, intentionally submitted Licensor inclusion Work copyright owner individual Legal Entity authorized submit behalf copyright owner. purposes definition, “submitted” means form electronic, verbal, written communication sent Licensor representatives, including limited communication electronic mailing lists, source code control systems, issue tracking systems managed , behalf , Licensor purpose discussing improving Work, excluding communication conspicuously marked otherwise designated writing copyright owner “Contribution.” “Contributor” shall mean Licensor individual Legal Entity behalf Contribution received Licensor subsequently incorporated within Work.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_2-grant-of-copyright-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"2. Grant of Copyright License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable copyright license reproduce, prepare Derivative Works , publicly display, publicly perform, sublicense, distribute Work Derivative Works Source Object form.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_3-grant-of-patent-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"3. Grant of Patent License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable (except stated section) patent license make, made, use, offer sell, sell, import, otherwise transfer Work, license applies patent claims licensable Contributor necessarily infringed Contribution(s) alone combination Contribution(s) Work Contribution(s) submitted. institute patent litigation entity (including cross-claim counterclaim lawsuit) alleging Work Contribution incorporated within Work constitutes direct contributory patent infringement, patent licenses granted License Work shall terminate date litigation filed.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_4-redistribution","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"4. Redistribution","title":"Apache License","text":"may reproduce distribute copies Work Derivative Works thereof medium, without modifications, Source Object form, provided meet following conditions: () must give recipients Work Derivative Works copy License; (b) must cause modified files carry prominent notices stating changed files; (c) must retain, Source form Derivative Works distribute, copyright, patent, trademark, attribution notices Source form Work, excluding notices pertain part Derivative Works; (d) Work includes “NOTICE” text file part distribution, Derivative Works distribute must include readable copy attribution notices contained within NOTICE file, excluding notices pertain part Derivative Works, least one following places: within NOTICE text file distributed part Derivative Works; within Source form documentation, provided along Derivative Works; , within display generated Derivative Works, wherever third-party notices normally appear. contents NOTICE file informational purposes modify License. may add attribution notices within Derivative Works distribute, alongside addendum NOTICE text Work, provided additional attribution notices construed modifying License. may add copyright statement modifications may provide additional different license terms conditions use, reproduction, distribution modifications, Derivative Works whole, provided use, reproduction, distribution Work otherwise complies conditions stated License.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_5-submission-of-contributions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"5. Submission of Contributions","title":"Apache License","text":"Unless explicitly state otherwise, Contribution intentionally submitted inclusion Work Licensor shall terms conditions License, without additional terms conditions. Notwithstanding , nothing herein shall supersede modify terms separate license agreement may executed Licensor regarding Contributions.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_6-trademarks","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"6. Trademarks","title":"Apache License","text":"License grant permission use trade names, trademarks, service marks, product names Licensor, except required reasonable customary use describing origin Work reproducing content NOTICE file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_7-disclaimer-of-warranty","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"7. Disclaimer of Warranty","title":"Apache License","text":"Unless required applicable law agreed writing, Licensor provides Work (Contributor provides Contributions) “” BASIS, WITHOUT WARRANTIES CONDITIONS KIND, either express implied, including, without limitation, warranties conditions TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS PARTICULAR PURPOSE. solely responsible determining appropriateness using redistributing Work assume risks associated exercise permissions License.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_8-limitation-of-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"8. Limitation of Liability","title":"Apache License","text":"event legal theory, whether tort (including negligence), contract, otherwise, unless required applicable law (deliberate grossly negligent acts) agreed writing, shall Contributor liable damages, including direct, indirect, special, incidental, consequential damages character arising result License use inability use Work (including limited damages loss goodwill, work stoppage, computer failure malfunction, commercial damages losses), even Contributor advised possibility damages.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_9-accepting-warranty-or-additional-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"9. Accepting Warranty or Additional Liability","title":"Apache License","text":"redistributing Work Derivative Works thereof, may choose offer, charge fee , acceptance support, warranty, indemnity, liability obligations /rights consistent License. However, accepting obligations, may act behalf sole responsibility, behalf Contributor, agree indemnify, defend, hold Contributor harmless liability incurred , claims asserted , Contributor reason accepting warranty additional liability. END TERMS CONDITIONS","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"appendix-how-to-apply-the-apache-license-to-your-work","dir":"","previous_headings":"","what":"APPENDIX: How to apply the Apache License to your work","title":"Apache License","text":"apply Apache License work, attach following boilerplate notice, fields enclosed brackets [] replaced identifying information. (Don’t include brackets!) text enclosed appropriate comment syntax file format. also recommend file class name description purpose included “printed page” copyright notice easier identification within third-party archives.","code":"Copyright 2024 Novo Nordisk A/S, Danish company registration no. 24256790 Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"connector","text":"vignette demonstrates use connector package connect either file system database access different types data. First let’s load packages ’re going use vignette: may notice ’re loading connector package, connector.databricks connector.sharepoint well. packages extend functionality connector package connect Databricks SharePoint, respectively.","code":"library(connector) library(connector.databricks) library(connector.sharepoint)"},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"connector-configuration","dir":"Articles","previous_headings":"","what":"Connector configuration","title":"connector","text":"Main function package connect(). function based configuration file list creates connectors() object connector specified datasources. configuration file can format can read read_file(), contains list. yaml file provided, expressions evaluated parsing using yaml::read_yaml() eval.expr = TRUE. input list (configuration file) following structure: metadata, env, connections, datasources fields allowed. elements must named. datasources mandatory. metadata env must list named character vectors length 1 specified. datasources must list unnamed lists. datasources must named character element name named list element backend connection backend.type must provided example configuration file different types connections: example multiple connections multiple data sources. ADaM data stored file system, metadata resides Databricks Tables, TFL also Databricks, Volumes, unstructured data stored. Finally, output stored SharePoint.","code":"metadata: trial: \"yyyy\" project: \"nnxxxx\" instance: \"current\" http_path: !!expr Sys.getenv(\"DATABRICKS_HTTP_PATH\") catalog: !!expr Sys.getenv(\"DATABRICKS_CATALOG_NAME\") sharepoint: \"https://my_organisation.sharepoint.com\" root_path: \"/home/my_root_path\" datasources: - name: \"adam\" backend: type: \"fs\" path: \"{root_path}/{project}/{trial}/{instance}/adam\" - name: \"tfl\" backend: type: \"connector.databricks::connector_databricks_volume\" catalog: \"{metadata.catalog}\" schema: \"{metadata.project}_{metadata.trial}_tfl\" path: \"output\" - name: \"metadata\" backend: type: \"connector.databricks::connector_databricks_dbi\" http_path: \"{metadata.http_path}\" catalog: \"{metadata.catalog}\" schema: \"{metadata.project}_{metadata.trial}_metadata\" - name: \"output_sh\" backend: type: \"connector.sharepoint::connector_sharepoint\" site_url: \"{metadata.sharepoint}/sites/{metadata.project}_{metadata.trial}_output\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"connect-to-datasources","dir":"Articles","previous_headings":"","what":"Connect to datasources","title":"connector","text":"want connect datasources can use connect() function. creates list connectors, can accessed names: setup done can use connections read write data datasources.","code":"# Load data connections db <- connect() # ADaM data db$adam # TFL data db$tfl # Metadata db$metadata # Output on SharePoint db$output_sh"},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"reading-and-writing-data","dir":"Articles","previous_headings":"","what":"Reading and writing data","title":"connector","text":"connector packages provide set functions read write data datasources. similar interface, ’s easy switch . Now, show read write different types data /different datasources. examples using iris mtcars datasets. example writing data ADaM table: Now, let’s read data back manipulate bit write SharePoint DataBricks. way can save different types data different formats.","code":"library(dplyr) # Manipulate data ## Iris data setosa <- iris |> filter(Species == \"setosa\") mean_for_all_iris <- iris |> group_by(Species) |> summarise_all(list(mean, median, sd, min, max)) ## Mtcars data cars <- mtcars |> filter(mpg > 22) mean_for_all_mtcars <- mtcars |> group_by(gear) |> summarise( across( everything(), list(\"mean\" = mean, \"median\" = median, \"sd\" = sd, \"min\" = min, \"max\" = max), .names = \"{.col}_{.fn}\") ) |> tidyr::pivot_longer( cols = -gear, names_to = c(\".value\", \"stat\"), names_sep = \"_\" ) ## Store data db$adam |> write_cnt(setosa, \"setosa\", overwrite = TRUE) db$adam |> write_cnt(mean_for_all_iris, \"mean_iris\", overwrite = TRUE) db$adam |> write_cnt(cars, \"cars_mpg\", overwrite = TRUE) db$adam |> write_cnt(mean_for_all_mtcars, \"mean_mtcars\", overwrite = TRUE) library(gt) library(tidyr) library(ggplot2) # List and load data db$adam |> list_content_cnt() table <- db$adam |> read_cnt(\"mean_mtcars\") gttable <- table |> gt(groupname_col = \"gear\") ## Save table db$tfl$write_cnt(gttable$`_data`, \"tmeanallmtcars.csv\") db$tfl$write_cnt(gttable, \"tmeanallmtcars.rds\") ## Using Sharepoint tmp_file <- tempfile(fileext = \".docx\") gtsave(gttable, tmp_file) db$output_sh$upload_cnt(tmp_file, \"tmeanallmtcars.docx\") # Manipulate data setosa_fsetosa <- db$adam |> read_cnt(\"setosa\") |> filter(Sepal.Length > 5) fsetosa <- ggplot(setosa) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point() ## Using Databricks Volumes ## Store Tfls db$tfl$write_cnt(fsetosa$data, \"fsetosa.csv\") db$tfl$write_cnt(fsetosa, \"fsetosa.rds\") ## Using Sharepoint tmp_file <- tempfile(fileext = \".png\") ggsave(tmp_file, fsetosa) db$output_sh$upload(tmp_file, \"fsetosa.png\") ## Using Databricks Volumes db$tfl$upload_cnt(contents = tmp_file, file_path = \"fsetosa.png\")"},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"working-example","dir":"Articles","previous_headings":"","what":"Working example","title":"connector","text":"example anyone can run see connector package works. use configuration file provided , use file system type connection ADaM TFL data. Now, let’s run example:","code":"metadata: adam_path: !expr file.path(tempdir(), \"adam\") tfl_path: !expr file.path(tempdir(), \"tfl\") datasources: - name: \"adam\" backend: type: \"connector_fs\" path: \"{metadata.adam_path}\" - name: \"tfl\" backend: type: \"connector_fs\" path: \"{metadata.tfl_path}\" library(connector) library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union library(ggplot2) # Let's create ADaM and TFL directories in temporary directory of the session dir.create(file.path(tempdir(), \"adam\")) dir.create(file.path(tempdir(), \"tfl\")) # Get example configuration from file config_file <- system.file(\"config\", \"config_file_system.yml\", package = \"connector\") # Load data connections db <- connect(config = config_file) #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /tmp/Rtmptg6cNO/adam #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → tfl #> • connector_fs #> • /tmp/Rtmptg6cNO/tfl ## Iris data setosa <- iris |> filter(Species == \"setosa\") mean_for_all_iris <- iris |> group_by(Species) |> summarise_all(list(mean, median, sd, min, max)) ## Store data db$adam |> write_cnt(setosa, \"setosa.rds\") db$adam |> write_cnt(mean_for_all_iris, \"mean_iris.rds\") ## List and load data db$adam |> list_content_cnt() #> [1] \"mean_iris.rds\" \"setosa.rds\" # Manipulate data setosa_fsetosa <- db$adam |> read_cnt(\"setosa\") |> filter(Sepal.Length > 5) fsetosa <- ggplot(setosa) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point() ## Store Tfls db$tfl$write_cnt(fsetosa$data, \"fsetosa.csv\") db$tfl$write_cnt(fsetosa, \"fsetosa.rds\") ## Store images tmp_file <- tempfile(fileext = \".png\") ggsave(tmp_file, fsetosa) #> Saving 7.29 x 4.51 in image db$tfl$upload_cnt(tmp_file, \"fsetosa.png\") # Check if everything is written into temporary TFL directory db$tfl$list_content_cnt() #> [1] \"fsetosa.csv\" \"fsetosa.png\" \"fsetosa.rds\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"connector","text":"vignette showed connect different datasources, read write data . used connector.databricks connector.sharepoint packages extend functionality connector package connect Databricks SharePoint, respectively. package designed extensible, new data sources can added easily.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"creating-a-new-connector","dir":"Articles","previous_headings":"","what":"Creating a new connector","title":"How to extend connector","text":"can create new connector creating new R6 class inherits connector: simplest type inheritance, note connector parent class methods e.g. reading (read_cnt()) writing (write_cnt()) data. cases want inherit either connector_fs() connector_dbi() depending new connector used access files databases respectively. create new connector_project class inherits acts exactly connector_fs(), instead user provide path folder argument, provide project name, path constructed . way extending connector e.g. relevant inside organisation projects stored common folder structure. initialize connector_project can see still methods connector_fs(), path assigned correctly based project argument: can now use connector read write data, just connector_fs():","code":"connector_myclass <- R6::R6Class( \"connector_myclass\", inherit = connector ) connector_myclass$new() #> #> Inherits from: connector_project <- R6::R6Class( \"connector_project\", inherit = connector_fs, public = list( initialize = function(project) { private$.project <- project path <- file.path(\"my_root_path\", project) super$initialize(path) } ), private = list( .project = NULL ), active = list( project = function() { private$.project } ) ) my_project <- connector_project$new(project = \"my_project\") print(my_project) #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project #> • project: my_project # First list current content: my_project |> list_content_cnt() #> character(0) # Write some content: my_project |> write_cnt(\"Hello world!\", \"my_file.txt\") # List content again: my_project |> list_content_cnt() #> [1] \"my_file.txt\" # Read the content: my_project |> read_cnt(\"my_file.txt\") #> [1] \"Hello world!\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"create-custom-generic-method","dir":"Articles","previous_headings":"","what":"Create custom generic method","title":"How to extend connector","text":"connectorgenerics list_content_cnt(), read_cnt(), write_cnt() S3 generics. means can create custom methods new connector class, used generic called, instead one associated parent class. illustrate can take look list_content_cnt() generic: Building example can define custom method list_content_cnt() connector_project class, used instead list_content_cnt.connector_fs(): course simple example, just prints message calling connector_fs method. can now see method available associated connector_project class: use list_content_cnt() my_project object, see custom method used get message:","code":"# Print the generic print(list_content_cnt) #> function (connector_object, ...) #> { #> UseMethod(\"list_content_cnt\") #> } #> #> # List the registered s3 methods methods(\"list_content_cnt\") |> cat(sep = \"\\n\") #> list_content_cnt.connector_dbi #> list_content_cnt.connector_fs #> list_content_cnt.default list_content_cnt.connector_project <- function(connector_object, ...) { cli::cli_alert(\"Listing content of {connector_object$project}\") NextMethod() } # List methods again methods(\"list_content_cnt\") |> cat(sep = \"\\n\") #> list_content_cnt.connector_dbi #> list_content_cnt.connector_fs #> list_content_cnt.connector_project #> list_content_cnt.default # Print my_project connector to see associated methods print(my_project) #> #> Inherits from: #> Registered methods: #> • `list_content_cnt.connector_project()` #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project #> • project: my_project my_project |> list_content_cnt() #> → Listing content of my_project #> [1] \"my_file.txt\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"use-extra-class-for-simple-customization","dir":"Articles","previous_headings":"","what":"Use extra class for simple customization","title":"How to extend connector","text":"just want slightly tweak behavior existing functionality alternative solution use extra_class argument initializing connector. argument adds extra_class first class creating connector, meaning generic dispatch, list_content_cnt(), method class used connector classes. redo two examples make new connector_fs extra class demo_extra: can see methods connector_fs(), demo_extra now first class class hierarchy. create custom method list_content_cnt() demo_extra connector_project : project information course available now, just print path instead, otherwise everything :","code":"my_project_extra <- connector_fs$new( path = \"my_root_path/my_project\", extra_class = \"my_extra_class\" ) print(my_project_extra) #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project list_content_cnt.my_extra_class <- function(connector_object, ...) { cli::cli_alert(\"Listing content of {connector_object$path}\") NextMethod() } # List methods methods(\"list_content_cnt\") #> [1] list_content_cnt.connector_dbi* list_content_cnt.connector_fs* #> [3] list_content_cnt.connector_project list_content_cnt.default* #> [5] list_content_cnt.my_extra_class #> see '?methods' for accessing help and source code # Print my_project_extra connector to see associated methods print(my_project_extra) #> #> Inherits from: #> Registered methods: #> • `list_content_cnt.my_extra_class()` #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project # List content to see the new message my_project_extra |> list_content_cnt() #> → Listing content of my_root_path/my_project #> [1] \"my_file.txt\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"special-handling-of-files","dir":"Articles","previous_headings":"","what":"Special handling of files","title":"How to extend connector","text":"special property file storage connectors (inheriting connector_fs()) operating files databases. means can handle multiple file formats, also file formats reading writing rectangular data. handling files user use read_cnt() write_cnt() generics, behind scenes following chain functions called: read_cnt() –> read_file() –> read_ext() –> External read function write_cnt() –> write_file() –> write_ext() –> External write function read_cnt() dispatches based class connector object. file storage connectors (inheriting connector_fs()) read_file() method called path file. read_file() helper function, calls read_ext() generic dispatches based file extension file, uses general functions packages read file. example file extension .csv read using readr::read_csv(). logic applies write_cnt().","code":""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"add-new-file-format","dir":"Articles","previous_headings":"Special handling of files","what":"Add new file format","title":"How to extend connector","text":"currently supported file types can seen reference read_cnt() write_cnt() functions respectively. let us imagine want support new imaginary file format myformat. order need create appropriate read_ext() write_ext() methods: can now use write read new file format existing my_project connector:","code":"read_ext.myformat <- function(path, ...) { cli::cli_alert(\"Reading myformat file\") readLines(con = path) } write_ext.myformat <- function(file, x, ...) { cli::cli_alert(\"Writing myformat file\") writeLines(text = x, con = file) } # List already existing content: my_project |> list_content_cnt() #> → Listing content of my_project #> [1] \"my_file.txt\" # Write some content in myformat: my_project |> write_cnt(\"Hello new format!\", \"new_file.myformat\") #> → Writing myformat file # List content again: my_project |> list_content_cnt() #> → Listing content of my_project #> [1] \"my_file.txt\" \"new_file.myformat\" # Read the content: my_project |> read_cnt(\"new_file.myformat\") #> → Reading myformat file #> [1] \"Hello new format!\""},{"path":"https://novonordisk-opensource.github.io/connector/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Cervan Girard. Author, maintainer. Aksel Thomsen. Author. Novo Nordisk /S. Copyright holder.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Girard C, Thomsen (2024). connector: Connect data easily. R package version 0.0.4.9000, https://github.com/novonordisk-opensource/connector, https://novonordisk-opensource.github.io/connector.","code":"@Manual{, title = {connector: Connect to your data easily}, author = {Cervan Girard and Aksel Thomsen}, year = {2024}, note = {R package version 0.0.4.9000, https://github.com/novonordisk-opensource/connector}, url = {https://novonordisk-opensource.github.io/connector}, }"},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Connect to your data easily","text":"connector provides seamless consistent interface connecting different data sources, simple file storage systems databases. also gives option use central configuration file manage connections project, ensures consistent reference data source across different scripts project, enables easily switch different data sources. connector package comes possibilities creating connections file system folders using connector_fs() general databases using connector_dbi(), built top DBI package. connector also series expansion packages allows easily connect specific data sources: {connector.databricks}: Connect Databricks {connector.sharepoint}: Connect SharePoint sites connector.logger: Log connector actions, see also whirl log scripts","code":""},{"path":"https://novonordisk-opensource.github.io/connector/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"Connect to your data easily","text":"recommended way using connector specify common yaml configuration file project contains connection details data sources. simple example creating connectors folder database shown : _connector.yml: First specify common metadata connectors, temporary folder want use. Afterwards specify datasources needed project, specifications. first name “folder”, specify type connector_fs(), path folder. second database connector memory SQLite database, specify using connector_dbi() type, uses DBI::dbConnect() initalize connection. Therefor also give DBI driver use, arguments . connect create conenctors use connect() configuration file input: creates connectors objects contains connector. printing individual conenctor get general information methods specifications. now ready use connectors, can start writing data folder one: parquet format used, using connector_fs() possible read write several different file types. See read_file() write_file() information. database connector works way:","code":"metadata: path: !expr withr::local_tempdir() datasources: - name: \"folder\" backend: type: \"connector_fs\" path: \"{metadata.path}\" - name: \"database\" backend: type: \"connector_dbi\" drv: \"RSQLite::SQLite()\" dbname: \":memory:\" library(connector) db <- connect(\"_connector.yml\") #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → folder #> • connector_fs #> • /var/folders/fx/71by3f551qzb5wkxt82cv15m0000gp/T//RtmpfTSxQB/file1c1d28730925 #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → database #> • connector_dbi #> • RSQLite::SQLite() and :memory: print(db) #> #> $folder #> $database print(db$database) #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: # Initially it is empty db$folder |> list_content_cnt() #> character(0) # Create some data cars <- mtcars |> tibble::as_tibble(rownames = \"car\") # Write to folder as a parquet file db$folder |> write_cnt(x = cars, name = \"cars.parquet\") # Now the folder contains the file db$folder |> list_content_cnt() #> [1] \"cars.parquet\" # And we can read it back in db$folder |> read_cnt(name = \"cars.parquet\") #> # A tibble: 32 × 12 #> car mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 Mazda RX4 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 Mazda RX4 … 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 Datsun 710 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 #> 4 Hornet 4 D… 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 5 Hornet Spo… 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 6 Valiant 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> 7 Duster 360 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 8 Merc 240D 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 #> 9 Merc 230 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 #> 10 Merc 280 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> # ℹ 22 more rows # Initially no tables exists db$database |> list_content_cnt() #> character(0) # Write cars to the database as a table db$database |> write_cnt(x = cars, name = \"cars\") # Now the cara table exists db$database |> list_content_cnt() #> [1] \"cars\" # And we can read it back in db$database |> read_cnt(name = \"cars\") |> dplyr::as_tibble() #> # A tibble: 32 × 12 #> car mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 Mazda RX4 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 Mazda RX4 … 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 Datsun 710 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 #> 4 Hornet 4 D… 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 5 Hornet Spo… 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 6 Valiant 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> 7 Duster 360 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 8 Merc 240D 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 #> 9 Merc 230 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 #> 10 Merc 280 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> # ℹ 22 more rows"},{"path":"https://novonordisk-opensource.github.io/connector/index.html","id":"useful-links","dir":"","previous_headings":"","what":"Useful links","title":"Connect to your data easily","text":"information use package, see following links: connect() documentation specify configuration file vignette(\"connector\") examples use package vignette(\"customize\") create connector customize behavior NovoNordisk-OpenSource/R-packages overview connector R packages published Novo Nordisk","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to datasources specified in a config file — connect","title":"Connect to datasources specified in a config file — connect","text":"Based configuration file list functions creates connectors() object connector specified datasources. configuration file can format can read read_file(), contains list. yaml file provided, expressions evaluated parsing using yaml::read_yaml() eval.expr = TRUE. See also vignette(\"connector\") use configuration files project, details required structure configuration.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to datasources specified in a config file — connect","text":"","code":"connect( config = \"_connector.yml\", metadata = NULL, datasource = NULL, set_env = TRUE, logging = FALSE )"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect to datasources specified in a config file — connect","text":"config character path connector config file list specifications metadata list Replace, add create elements metadata field found config datasource character Name(s) datasource(s) connect . NULL (default) datasources connected. set_env logical environment variables yaml file set? Default TRUE. logging logical Add logs console well whirl log html files. See details vignette.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to datasources specified in a config file — connect","text":"connectors","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Connect to datasources specified in a config file — connect","text":"input list can specified two ways: named list containing specifications single connectors object. unnamed list, element structure 1., returns nested connectors object. See example . specification single connectors following structure: name, metadata, env datasources allowed. elements must named. name required using nested connectors. datasources mandatory. metadata env must list named character vectors length 1 specified. datasources must list unnamed lists. datasource must named character element name named list element backend connection backend.type must provided","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to datasources specified in a config file — connect","text":"","code":"config <- system.file(\"config\", \"default_config.yml\", package = \"connector\") config #> [1] \"/home/runner/work/_temp/Library/connector/config/default_config.yml\" # Show the raw configuration file readLines(config) |> cat(sep = \"\\n\") #> # A example of the configuration file for FS and Database #> metadata: #> trial: \"demo_trial\" #> root_path: !expr system.file(package = \"connector\") #> extra_class: \"test2\" #> #> datasources: #> - name: \"adam\" #> backend: #> type: \"connector_fs\" #> path: \"{metadata.root_path}/{metadata.trial}/adam\" #> extra_class: \"{metadata.extra_class}\" #> - name: \"sdtm\" #> backend: #> type: \"connector_dbi\" #> drv: \"RSQLite::SQLite()\" #> dbname: \":memory:\" # Connect to the datasources specified in it cnts <- connect(config) #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam and test2 #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → sdtm #> • connector_dbi #> • RSQLite::SQLite() and :memory: cnts #> #> $adam #> $sdtm # Content of each connector cnts$adam #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: /home/runner/work/_temp/Library/connector/demo_trial/adam cnts$sdtm #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: # Overwrite metadata informations connect(config, metadata = list(extra_class = \"my_class\")) #> ℹ Replace some metadata informations... #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam and my_class #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → sdtm #> • connector_dbi #> • RSQLite::SQLite() and :memory: #> #> $adam #> $sdtm # Connect only to the adam datasource connect(config, datasource = \"adam\") #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam and test2 #> #> $adam # Connect to several projects in a nested structure config_nested <- system.file(\"config\", \"_connector_nested.yml\", package = \"connector\") readLines(config_nested) |> cat(sep = \"\\n\") #> # A example of the configuration file nested connectors #> - name: \"study1\" #> metadata: #> trial: \"demo_trial\" #> root_path: !expr system.file(package = \"connector\") #> datasources: #> - name: \"adam_fs\" #> backend: #> type: \"connector_fs\" #> path: \"{metadata.root_path}/{metadata.trial}/adam\" #> #> - name: \"study2\" #> metadata: #> trial: \"demo_trial\" #> root_path: !expr system.file(package = \"connector\") #> datasources: #> - name: \"adam_fs\" #> backend: #> type: \"connector_fs\" #> path: \"{metadata.root_path}/{metadata.trial}/adam\" cnts_nested <- connect(config_nested) #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam_fs #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam_fs #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam cnts_nested #> #> $study1 #> $study2 cnts_nested$study1 #> #> $adam_fs "},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector-package.html","id":null,"dir":"Reference","previous_headings":"","what":"connector: Connect to your data easily — connector-package","title":"connector: Connect to your data easily — connector-package","text":"connector package helps connecting R databases contains ADAM, STDM . package defines interface can reused databases.","code":""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"connector: Connect to your data easily — connector-package","text":"Maintainer: Cervan Girard cgid@novonordisk.com Authors: Aksel Thomsen oath@novonordisk.com contributors: Novo Nordisk /S [copyright holder]","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":null,"dir":"Reference","previous_headings":"","what":"General connector object — connector","title":"General connector object — connector","text":"R6 class general class connectors. used define methods connectors . New connectors inherit class, methods described implemented.","code":""},{"path":[]},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"General connector object — connector","text":"connector$new() connector$print() connector$list_content_cnt() connector$read_cnt() connector$write_cnt() connector$remove_cnt() connector$clone()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"General connector object — connector","text":"Initialize connector option adding extra class.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$new(extra_class = NULL)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"extra_class character Extra class assign new connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-print-","dir":"Reference","previous_headings":"","what":"Method print()","title":"General connector object — connector","text":"Print method connector showing registered methods specifications active bindings.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$print()"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-list-content-cnt-","dir":"Reference","previous_headings":"","what":"Method list_content_cnt()","title":"General connector object — connector","text":"List available content connector. See also list_content_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$list_content_cnt(...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"character vector content names","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-read-cnt-","dir":"Reference","previous_headings":"","what":"Method read_cnt()","title":"General connector object — connector","text":"Read content connector. See also read_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$read_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-2","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"R object content. rectangular data data.frame.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-write-cnt-","dir":"Reference","previous_headings":"","what":"Method write_cnt()","title":"General connector object — connector","text":"Write content connector.See also write_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$write_cnt(x, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-3","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"x object write connection name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-3","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-remove-cnt-","dir":"Reference","previous_headings":"","what":"Method remove_cnt()","title":"General connector object — connector","text":"Remove delete content connector. See also remove_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$remove_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-4","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-4","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"General connector object — connector","text":"objects class cloneable method.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-6","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$clone(deep = FALSE)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-5","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"deep Whether make deep clone.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"General connector object — connector","text":"","code":"# Create connector cnt <- connector$new() cnt #> # Standard error message if no method is implemented cnt |> read_cnt(\"fake_data\") |> try() #> Error in read_cnt(cnt, \"fake_data\") : #> Method not implemented for class #> ℹ See the customize (`vignette(connector::customize)`) vignette on how to #> create custom connectors and methods # Connection with extra class cnt_my_class <- connector$new(extra_class = \"my_class\") cnt_my_class #> # Custom method for the extra class read_cnt.my_class <- function(connector_object) \"Hello!\" registerS3method(\"read_cnt\", \"my_class\", \"read_cnt.my_class\") cnt_my_class #> #> Registered methods: #> • `read_cnt.my_class()` read_cnt(cnt_my_class) #> [1] \"Hello!\""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":null,"dir":"Reference","previous_headings":"","what":"Connector for DBI databases — connector_dbi","title":"Connector for DBI databases — connector_dbi","text":"Connector object DBI connections. object used interact DBI compliant database backends. See DBI package backends supported.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Connector for DBI databases — connector_dbi","text":"Upon garbage collection, connection try disconnect database. good practice call disconnect_cnt done connection.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"super-class","dir":"Reference","previous_headings":"","what":"Super class","title":"Connector for DBI databases — connector_dbi","text":"connector::connector -> connector_dbi","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"active-bindings","dir":"Reference","previous_headings":"","what":"Active bindings","title":"Connector for DBI databases — connector_dbi","text":"conn DBI connection. Inherits DBI::DBIConnector","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Connector for DBI databases — connector_dbi","text":"connector::connector$list_content_cnt() connector::connector$print() connector::connector$read_cnt() connector::connector$remove_cnt() connector::connector$write_cnt()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"Connector for DBI databases — connector_dbi","text":"connector_dbi$new() connector_dbi$disconnect_cnt() connector_dbi$tbl_cnt() connector_dbi$clone()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"Connector for DBI databases — connector_dbi","text":"Initialize connection","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$new(drv, ..., extra_class = NULL)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for DBI databases — connector_dbi","text":"drv Driver object inheriting DBI::DBIDriver. ... Additional arguments passed DBI::dbConnect(). extra_class character Extra class assign new connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-disconnect-cnt-","dir":"Reference","previous_headings":"","what":"Method disconnect_cnt()","title":"Connector for DBI databases — connector_dbi","text":"Disconnect database. See also disconnect_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$disconnect_cnt()"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for DBI databases — connector_dbi","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-tbl-cnt-","dir":"Reference","previous_headings":"","what":"Method tbl_cnt()","title":"Connector for DBI databases — connector_dbi","text":"Use dplyr verbs interact remote database table. See also tbl_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$tbl_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for DBI databases — connector_dbi","text":"name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for DBI databases — connector_dbi","text":"dplyr::tbl object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"Connector for DBI databases — connector_dbi","text":"objects class cloneable method.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$clone(deep = FALSE)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for DBI databases — connector_dbi","text":"deep Whether make deep clone.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connector for DBI databases — connector_dbi","text":"","code":"# Create DBI connector cnt <- connector_dbi$new(RSQLite::SQLite(), \":memory:\") cnt #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: # Write to the database cnt$write_cnt(iris, \"iris\") # Read from the database cnt$read_cnt(\"iris\") |> head() #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa # List available tables cnt$list_content_cnt() #> [1] \"iris\" # Use the connector to run a query cnt$conn #> #> Path: :memory: #> Extensions: TRUE cnt$conn |> DBI::dbGetQuery(\"SELECT * FROM iris limit 5\") #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa # Use dplyr verbs and collect data cnt$tbl_cnt(\"iris\") |> dplyr::filter(Sepal.Length > 7) |> dplyr::collect() #> # A tibble: 12 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 7.1 3 5.9 2.1 virginica #> 2 7.6 3 6.6 2.1 virginica #> 3 7.3 2.9 6.3 1.8 virginica #> 4 7.2 3.6 6.1 2.5 virginica #> 5 7.7 3.8 6.7 2.2 virginica #> 6 7.7 2.6 6.9 2.3 virginica #> 7 7.7 2.8 6.7 2 virginica #> 8 7.2 3.2 6 1.8 virginica #> 9 7.2 3 5.8 1.6 virginica #> 10 7.4 2.8 6.1 1.9 virginica #> 11 7.9 3.8 6.4 2 virginica #> 12 7.7 3 6.1 2.3 virginica # Disconnect from the database cnt$disconnect_cnt()"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":null,"dir":"Reference","previous_headings":"","what":"Connector for file storage — connector_fs","title":"Connector for file storage — connector_fs","text":"connector_fs class file storage connector accessing manipulating files file storage solution. default implementation includes methods files stored local network drives.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"super-class","dir":"Reference","previous_headings":"","what":"Super class","title":"Connector for file storage — connector_fs","text":"connector::connector -> connector_fs","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"active-bindings","dir":"Reference","previous_headings":"","what":"Active bindings","title":"Connector for file storage — connector_fs","text":"path character Path file storage","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Connector for file storage — connector_fs","text":"connector::connector$list_content_cnt() connector::connector$print() connector::connector$read_cnt() connector::connector$remove_cnt() connector::connector$write_cnt()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"Connector for file storage — connector_fs","text":"connector_fs$new() connector_fs$download_cnt() connector_fs$upload_cnt() connector_fs$create_directory_cnt() connector_fs$remove_directory_cnt() connector_fs$clone()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"Connector for file storage — connector_fs","text":"Initializes connector file storage.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$new(path, extra_class = NULL)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"path character Path file storage extra_class character Extra class added Checked using checkmate::assert_directory_exists.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-download-cnt-","dir":"Reference","previous_headings":"","what":"Method download_cnt()","title":"Connector for file storage — connector_fs","text":"Download content file storage. See also download_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$download_cnt(name, file = basename(name), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"name character Name content read, write, remove. Typically table name. file character Path file download upload ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"invisible file","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-upload-cnt-","dir":"Reference","previous_headings":"","what":"Method upload_cnt()","title":"Connector for file storage — connector_fs","text":"Upload file file storage. See also upload_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$upload_cnt(file, name = basename(file), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"file character Path file download upload name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-create-directory-cnt-","dir":"Reference","previous_headings":"","what":"Method create_directory_cnt()","title":"Connector for file storage — connector_fs","text":"Create directory file storage. See also create_directory_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$create_directory_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-3","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"name character name directory create ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns-2","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"connector_fs object newly created directory","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-remove-directory-cnt-","dir":"Reference","previous_headings":"","what":"Method remove_directory_cnt()","title":"Connector for file storage — connector_fs","text":"Remove directory file storage. See also remove_directory_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$remove_directory_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-4","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"name character name directory remove ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns-3","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"Connector for file storage — connector_fs","text":"objects class cloneable method.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$clone(deep = FALSE)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-5","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"deep Whether make deep clone.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connector for file storage — connector_fs","text":"","code":"# Create file storage connector cnt <- connector_fs$new(tempdir()) cnt #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: /tmp/Rtmp704dnN # List content cnt$list_content_cnt() #> [1] \"bslib-60b44f9663e91341c79e0df466adbe7c\" #> [2] \"downlit\" #> [3] \"file18593ff5caa7\" #> [4] \"file185947472f0b\" #> [5] \"file18597e232188\" #> [6] \"file18597ed13f7f\" #> [7] \"repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds\" # Write to the connector cnt$write_cnt(iris, \"iris.rds\") # Check it is there cnt$list_content_cnt() #> [1] \"bslib-60b44f9663e91341c79e0df466adbe7c\" #> [2] \"downlit\" #> [3] \"file18593ff5caa7\" #> [4] \"file185947472f0b\" #> [5] \"file18597e232188\" #> [6] \"file18597ed13f7f\" #> [7] \"iris.rds\" #> [8] \"repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds\" # Read the result back cnt$read_cnt(\"iris.rds\") |> head() #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":null,"dir":"Reference","previous_headings":"","what":"Collection of connector objects — connectors","title":"Collection of connector objects — connectors","text":"Holds special list individual connector objects consistent use connections project.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collection of connector objects — connectors","text":"","code":"connectors(...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collection of connector objects — connectors","text":"... Named individual connector objects","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collection of connector objects — connectors","text":"","code":"# Create connectors objects con <- connectors( sdtm = connector_fs$new(path = tempdir()), adam = connector_dbi$new(drv = RSQLite::SQLite()) ) # Print for overview con #> #> $sdtm #> $adam # Print the individual connector for more information con$sdtm #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: /tmp/Rtmp704dnN con$adam #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: "},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a directory — create_directory_cnt","title":"Create a directory — create_directory_cnt","text":"Generic implementing create directory connector. Mostly relevant file storage connectors. connector_fs: Uses dir.create() create directory path connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a directory — create_directory_cnt","text":"","code":"create_directory_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' create_directory_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a directory — create_directory_cnt","text":"connector_object connector connector object use. name character name directory create ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a directory — create_directory_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a directory — create_directory_cnt","text":"","code":"# Create a directory in a file storage cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt(pattern = \"new_folder\") #> character(0) cnt |> create_directory_cnt(\"new_folder\") # This will return new connector object of a newly created folder new_connector <- cnt |> list_content_cnt(pattern = \"new_folder\") cnt |> remove_directory_cnt(\"new_folder\")"},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Disconnect (close) the connection of the connector — disconnect_cnt","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"Generic implementing disconnect relevant connections. Mostly relevant DBI connectors. connector_dbi: Uses DBI::dbDisconnect() create table reference close DBI connection.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"","code":"disconnect_cnt(connector_object, ...) # S3 method for class 'connector_dbi' disconnect_cnt(connector_object, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"connector_object connector connector object use. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"","code":"# Open and close a DBI connector cnt <- connector_dbi$new(RSQLite::SQLite()) cnt$conn #> #> Path: #> Extensions: TRUE cnt |> disconnect_cnt() cnt$conn #> #> DISCONNECTED"},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Download content from the connector — download_cnt","title":"Download content from the connector — download_cnt","text":"Generic implementing download files connector: connector_fs: Uses file.copy() copy file file storage desired file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Download content from the connector — download_cnt","text":"","code":"download_cnt(connector_object, name, file = basename(name), ...) # S3 method for class 'connector_fs' download_cnt(connector_object, name, file = basename(name), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Download content from the connector — download_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. file character Path file download upload ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Download content from the connector — download_cnt","text":"invisible file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Download content from the connector — download_cnt","text":"","code":"# Download file from a file storage cnt <- connector_fs$new(tempdir()) cnt |> write_cnt(\"this is an example\", \"example.txt\") list.files(pattern = \"example.txt\") #> character(0) cnt |> download_cnt(\"example.txt\") list.files(pattern = \"example.txt\") #> [1] \"example.txt\" readLines(\"example.txt\") #> [1] \"this is an example\" cnt |> remove_cnt(\"example.txt\")"},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"List available content from the connector — list_content_cnt","title":"List available content from the connector — list_content_cnt","text":"Generic implementing list content available different connectors: connector_dbi: Uses DBI::dbListTables() list tables DBI connection. connector_fs: Uses list.files() list files path connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List available content from the connector — list_content_cnt","text":"","code":"list_content_cnt(connector_object, ...) # S3 method for class 'connector_dbi' list_content_cnt(connector_object, ...) # S3 method for class 'connector_fs' list_content_cnt(connector_object, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List available content from the connector — list_content_cnt","text":"connector_object connector connector object use. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List available content from the connector — list_content_cnt","text":"character vector content names","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List available content from the connector — list_content_cnt","text":"","code":"# List tables in a DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> list_content_cnt() #> character(0) # List content in a file storage cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt() #> [1] \"bslib-60b44f9663e91341c79e0df466adbe7c\" #> [2] \"downlit\" #> [3] \"file18593ff5caa7\" #> [4] \"file185947472f0b\" #> [5] \"file185958887b1f\" #> [6] \"file18597e232188\" #> [7] \"file18597ed13f7f\" #> [8] \"iris.rds\" #> [9] \"repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds\" # Only list CSV files using the pattern argument of list.files cnt |> list_content_cnt(pattern = \"\\\\.csv$\") #> character(0)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/options.html","id":null,"dir":"Reference","previous_headings":"","what":"connector Options — options","title":"connector Options — options","text":"Internally used, package-specific options. options prioritize R options() values, fall back environment variables undefined. neither option environment variable set, default value used.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/options.html","id":"checking-option-values","dir":"Reference","previous_headings":"","what":"Checking Option Values","title":"connector Options — options","text":"Option values specific connector can accessed passing package name env.","code":"options::opts(env = \"connector\") options::opt(x, default, env = \"connector\")"},{"path":"https://novonordisk-opensource.github.io/connector/reference/options.html","id":"options","dir":"Reference","previous_headings":"","what":"Options","title":"connector Options — options","text":"verbosity_level default: \"verbose\" option: connector.verbosity_level envvar: R_CONNECTOR_VERBOSITY_LEVEL (evaluated possible, raw string otherwise)","code":"\"verbose\""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/reference/options_params.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal reuse of options description — options_params","title":"Internal reuse of options description — options_params","text":"Internal reuse options description","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/options_params.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Internal reuse of options description — options_params","text":"verbosity_level chatty log ? Possibilities quiet, verbose, debug. (Defaults \"verbose\", overwritable using option 'connector.verbosity_level' environment variable 'R_CONNECTOR_VERBOSITY_LEVEL')","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Read content from the connector — read_cnt","title":"Read content from the connector — read_cnt","text":"Generic implementing read content different connector objects: connector_dbi: Uses DBI::dbReadTable() read table DBI connection. connector_fs: Uses read_file() read given file. underlying function used, thereby also arguments available ... depends file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read content from the connector — read_cnt","text":"","code":"read_cnt(connector_object, name, ...) # S3 method for class 'connector_dbi' read_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' read_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read content from the connector — read_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read content from the connector — read_cnt","text":"R object content. rectangular data data.frame.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read content from the connector — read_cnt","text":"","code":"# Read table from DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> write_cnt(iris, \"iris\") cnt |> list_content_cnt() #> [1] \"iris\" cnt |> read_cnt(\"iris\") |> head() #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa # Write and read a CSV file using the file storage connector cnt <- connector_fs$new(tempdir()) cnt |> write_cnt(iris, \"iris.csv\") cnt |> read_cnt(\"iris.csv\") |> head() #> Rows: 150 Columns: 5 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \",\" #> chr (1): Species #> dbl (4): Sepal.Length, Sepal.Width, Petal.Length, Petal.Width #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. #> # A tibble: 6 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa"},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Read files based on the extension — read_file","title":"Read files based on the extension — read_file","text":"read_file() backbone read_cnt methods, files read source. function wrapper around read_ext(), controls dispatch based file extension. read_ext() controls packages functions used read individual file extensions. list pre-defined methods: default: extensions listed attempted read vroom::vroom() txt: readr::read_lines() csv: readr::read_csv() parquet: arrow::read_parquet() rds: readr::read_rds() sas7bdat: haven::read_sas() xpt: haven::read_xpt() yml/yaml: yaml::read_yaml() json: jsonlite::read_json()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read files based on the extension — read_file","text":"","code":"read_file(path, ...) read_ext(path, ...) # Default S3 method read_ext(path, ...) # S3 method for class 'txt' read_ext(path, ...) # S3 method for class 'csv' read_ext(path, ...) # S3 method for class 'parquet' read_ext(path, ...) # S3 method for class 'rds' read_ext(path, ...) # S3 method for class 'sas7bdat' read_ext(path, ...) # S3 method for class 'xpt' read_ext(path, ...) # S3 method for class 'yml' read_ext(path, ...) # S3 method for class 'json' read_ext(path, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read files based on the extension — read_file","text":"path character() Path file. ... parameters passed functions behind methods file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read files based on the extension — read_file","text":"result reading function","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read files based on the extension — read_file","text":"","code":"# Read CSV file temp_csv <- tempfile(\"iris\", fileext = \".csv\") write.csv(iris, temp_csv, row.names = FALSE) read_file(temp_csv) #> Rows: 150 Columns: 5 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \",\" #> chr (1): Species #> dbl (4): Sepal.Length, Sepal.Width, Petal.Length, Petal.Width #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. #> # A tibble: 150 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ℹ 140 more rows"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove content from the connector — remove_cnt","title":"Remove content from the connector — remove_cnt","text":"Generic implementing remove content different connectors: connector_dbi: Uses DBI::dbRemoveTable() remove table DBI connection. connector_fs: Uses unlink() delete file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove content from the connector — remove_cnt","text":"","code":"remove_cnt(connector_object, name, ...) # S3 method for class 'connector_dbi' remove_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' remove_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove content from the connector — remove_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove content from the connector — remove_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove content from the connector — remove_cnt","text":"","code":"# Remove table in a DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> write_cnt(iris, \"iris\") |> list_content_cnt() #> [1] \"iris\" cnt |> remove_cnt(\"iris\") |> list_content_cnt() #> character(0) # Remove a file from the file storage cnt <- connector_fs$new(tempdir()) cnt |> write_cnt(\"this is an example\", \"example.txt\") cnt |> list_content_cnt(pattern = \"example.txt\") #> [1] \"example.txt\" cnt |> read_cnt(\"example.txt\") #> [1] \"this is an example\" cnt |> remove_cnt(\"example.txt\") cnt |> list_content_cnt(pattern = \"example.txt\") #> character(0)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a directory — remove_directory_cnt","title":"Remove a directory — remove_directory_cnt","text":"Generic implementing remove directory connector. Mostly relevant file storage connectors. connector_fs: Uses unlink() recursive = TRUE remove directory path connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a directory — remove_directory_cnt","text":"","code":"remove_directory_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' remove_directory_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a directory — remove_directory_cnt","text":"connector_object connector connector object use. name character name directory remove ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a directory — remove_directory_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove a directory — remove_directory_cnt","text":"","code":"# Remove a directory from a file storage cnt <- connector_fs$new(tempdir()) cnt |> create_directory_cnt(\"new_folder\") cnt |> list_content_cnt(pattern = \"new_folder\") #> [1] \"new_folder\" cnt |> remove_directory_cnt(\"new_folder\") |> list_content_cnt(pattern = \"new_folder\") #> character(0)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Use dplyr verbs to interact with the remote database table — tbl_cnt","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"Generic implementing create dplyr::tbl() connection order use dplyr verbs interact remote database table. Mostly relevant DBI connectors. connector_dbi: Uses dplyr::tbl() create table reference table DBI connection.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"","code":"tbl_cnt(connector_object, name, ...) # S3 method for class 'connector_dbi' tbl_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"dplyr::tbl object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"","code":"# Use dplyr verbs on a table in a DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) iris_cnt <- cnt |> write_cnt(iris, \"iris\") |> tbl_cnt(\"iris\") iris_cnt #> # Source: table<`iris`> [?? x 5] #> # Database: sqlite 3.47.1 [] #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ℹ more rows iris_cnt |> dplyr::collect() #> # A tibble: 150 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ℹ 140 more rows iris_cnt |> dplyr::group_by(Species) |> dplyr::summarise( n = dplyr::n(), mean.Sepal.Length = mean(Sepal.Length, na.rm = TRUE) ) |> dplyr::collect() #> # A tibble: 3 × 3 #> Species n mean.Sepal.Length #> #> 1 setosa 50 5.01 #> 2 versicolor 50 5.94 #> 3 virginica 50 6.59"},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Upload content to the connector — upload_cnt","title":"Upload content to the connector — upload_cnt","text":"Generic implementing upload files connector: connector_fs: Uses file.copy() copy file file storage.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Upload content to the connector — upload_cnt","text":"","code":"upload_cnt(connector_object, file, name = basename(file), ...) # S3 method for class 'connector_fs' upload_cnt(connector_object, file, name = basename(file), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Upload content to the connector — upload_cnt","text":"connector_object connector connector object use. file character Path file download upload name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Upload content to the connector — upload_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Upload content to the connector — upload_cnt","text":"","code":"# Upload file to a file storage writeLines(\"this is an example\", \"example.txt\") cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt(pattern = \"example.txt\") #> character(0) cnt |> upload_cnt(\"example.txt\") cnt |> list_content_cnt(pattern = \"example.txt\") #> [1] \"example.txt\" cnt |> remove_cnt(\"example.txt\") file.remove(\"example.txt\") #> [1] TRUE"},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Write content to the connector — write_cnt","title":"Write content to the connector — write_cnt","text":"Generic implementing write content different connector objects: connector_dbi: Uses DBI::dbWriteTable() write table DBI connection. connector_fs: Uses write_file() Write file based file extension. underlying function used, thereby also arguments available ... depends file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write content to the connector — write_cnt","text":"","code":"write_cnt(connector_object, x, name, ...) # S3 method for class 'connector_dbi' write_cnt(connector_object, x, name, ...) # S3 method for class 'connector_fs' write_cnt(connector_object, x, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write content to the connector — write_cnt","text":"connector_object connector connector object use. x object write connection name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write content to the connector — write_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write content to the connector — write_cnt","text":"","code":"# Write table to DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> list_content_cnt() #> character(0) cnt |> write_cnt(iris, \"iris\") cnt |> list_content_cnt() #> [1] \"iris\" # Write different file types to a file storage cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt(pattern = \"iris\") #> [1] \"iris.csv\" \"iris.rds\" \"iris185958354759.csv\" # rds file cnt |> write_cnt(iris, \"iris.rds\") # CSV file cnt |> write_cnt(iris, \"iris.csv\") cnt |> list_content_cnt(pattern = \"iris\") #> [1] \"iris.csv\" \"iris.rds\" \"iris185958354759.csv\""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Write files based on the extension — write_file","title":"Write files based on the extension — write_file","text":"write_file() backbone write_cnt() methods, files written connector. function wrapper around write_ext() appropriate function write file chosen depending file extension. write_ext() methods defined following file extensions: txt: readr::write_lines() csv: readr::write_csv() parquet: arrow::write_parquet() rds: readr::write_rds() sas7bdat: haven::write_sas() yml/yaml: yaml::write_yaml()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write files based on the extension — write_file","text":"","code":"write_file(x, file, ...) write_ext(file, x, ...) # S3 method for class 'txt' write_ext(file, x, ...) # S3 method for class 'csv' write_ext(file, x, ...) # S3 method for class 'parquet' write_ext(file, x, ...) # S3 method for class 'rds' write_ext(file, x, ...) # S3 method for class 'xpt' write_ext(file, x, ...) # S3 method for class 'yml' write_ext(file, x, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write files based on the extension — write_file","text":"x Object write file character() Path write file ... parameters passed functions behind methods file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write files based on the extension — write_file","text":"write_file(): invisible() file. write_ext(): return functions behind individual methods.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write files based on the extension — write_file","text":"","code":"# Write CSV file temp_csv <- tempfile(\"iris\", fileext = \".csv\") write_file(iris, temp_csv)"},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"migration-0-0-4","dir":"Changelog","previous_headings":"","what":"Migration:","title":"connector 0.0.4 (2024-12-03)","text":"Migration public github","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"features-0-0-4","dir":"Changelog","previous_headings":"","what":"Features:","title":"connector 0.0.4 (2024-12-03)","text":"Update create_directory_cnt() Added metadata parameter connect() comprehensive testing Better integration whirl connector.logger","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"other-0-0-4","dir":"Changelog","previous_headings":"","what":"Other:","title":"connector 0.0.4 (2024-12-03)","text":"Reducing number dependencies. Better messages","code":""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"breaking-changes-0-0-3","dir":"Changelog","previous_headings":"","what":"Breaking Changes:","title":"connector 0.0.3 (2024-09-25)","text":"rename function *_cnt cnt_","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"features-0-0-3","dir":"Changelog","previous_headings":"","what":"Features:","title":"connector 0.0.3 (2024-09-25)","text":"Nested connectors objects Use active bindings User guide added","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"connector-002","dir":"Changelog","previous_headings":"","what":"connector 0.0.2","title":"connector 0.0.2","text":"Added connectors super class","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"connector-001","dir":"Changelog","previous_headings":"","what":"connector 0.0.1","title":"connector 0.0.1","text":"Initial version","code":""}] +[{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"Apache License","title":"Apache License","text":"Version 2.0, January 2004 ","code":""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_1-definitions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"1. Definitions","title":"Apache License","text":"“License” shall mean terms conditions use, reproduction, distribution defined Sections 1 9 document. “Licensor” shall mean copyright owner entity authorized copyright owner granting License. “Legal Entity” shall mean union acting entity entities control, controlled , common control entity. purposes definition, “control” means () power, direct indirect, cause direction management entity, whether contract otherwise, (ii) ownership fifty percent (50%) outstanding shares, (iii) beneficial ownership entity. “” (“”) shall mean individual Legal Entity exercising permissions granted License. “Source” form shall mean preferred form making modifications, including limited software source code, documentation source, configuration files. “Object” form shall mean form resulting mechanical transformation translation Source form, including limited compiled object code, generated documentation, conversions media types. “Work” shall mean work authorship, whether Source Object form, made available License, indicated copyright notice included attached work (example provided Appendix ). “Derivative Works” shall mean work, whether Source Object form, based (derived ) Work editorial revisions, annotations, elaborations, modifications represent, whole, original work authorship. purposes License, Derivative Works shall include works remain separable , merely link (bind name) interfaces , Work Derivative Works thereof. “Contribution” shall mean work authorship, including original version Work modifications additions Work Derivative Works thereof, intentionally submitted Licensor inclusion Work copyright owner individual Legal Entity authorized submit behalf copyright owner. purposes definition, “submitted” means form electronic, verbal, written communication sent Licensor representatives, including limited communication electronic mailing lists, source code control systems, issue tracking systems managed , behalf , Licensor purpose discussing improving Work, excluding communication conspicuously marked otherwise designated writing copyright owner “Contribution.” “Contributor” shall mean Licensor individual Legal Entity behalf Contribution received Licensor subsequently incorporated within Work.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_2-grant-of-copyright-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"2. Grant of Copyright License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable copyright license reproduce, prepare Derivative Works , publicly display, publicly perform, sublicense, distribute Work Derivative Works Source Object form.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_3-grant-of-patent-license","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"3. Grant of Patent License","title":"Apache License","text":"Subject terms conditions License, Contributor hereby grants perpetual, worldwide, non-exclusive, -charge, royalty-free, irrevocable (except stated section) patent license make, made, use, offer sell, sell, import, otherwise transfer Work, license applies patent claims licensable Contributor necessarily infringed Contribution(s) alone combination Contribution(s) Work Contribution(s) submitted. institute patent litigation entity (including cross-claim counterclaim lawsuit) alleging Work Contribution incorporated within Work constitutes direct contributory patent infringement, patent licenses granted License Work shall terminate date litigation filed.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_4-redistribution","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"4. Redistribution","title":"Apache License","text":"may reproduce distribute copies Work Derivative Works thereof medium, without modifications, Source Object form, provided meet following conditions: () must give recipients Work Derivative Works copy License; (b) must cause modified files carry prominent notices stating changed files; (c) must retain, Source form Derivative Works distribute, copyright, patent, trademark, attribution notices Source form Work, excluding notices pertain part Derivative Works; (d) Work includes “NOTICE” text file part distribution, Derivative Works distribute must include readable copy attribution notices contained within NOTICE file, excluding notices pertain part Derivative Works, least one following places: within NOTICE text file distributed part Derivative Works; within Source form documentation, provided along Derivative Works; , within display generated Derivative Works, wherever third-party notices normally appear. contents NOTICE file informational purposes modify License. may add attribution notices within Derivative Works distribute, alongside addendum NOTICE text Work, provided additional attribution notices construed modifying License. may add copyright statement modifications may provide additional different license terms conditions use, reproduction, distribution modifications, Derivative Works whole, provided use, reproduction, distribution Work otherwise complies conditions stated License.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_5-submission-of-contributions","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"5. Submission of Contributions","title":"Apache License","text":"Unless explicitly state otherwise, Contribution intentionally submitted inclusion Work Licensor shall terms conditions License, without additional terms conditions. Notwithstanding , nothing herein shall supersede modify terms separate license agreement may executed Licensor regarding Contributions.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_6-trademarks","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"6. Trademarks","title":"Apache License","text":"License grant permission use trade names, trademarks, service marks, product names Licensor, except required reasonable customary use describing origin Work reproducing content NOTICE file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_7-disclaimer-of-warranty","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"7. Disclaimer of Warranty","title":"Apache License","text":"Unless required applicable law agreed writing, Licensor provides Work (Contributor provides Contributions) “” BASIS, WITHOUT WARRANTIES CONDITIONS KIND, either express implied, including, without limitation, warranties conditions TITLE, NON-INFRINGEMENT, MERCHANTABILITY, FITNESS PARTICULAR PURPOSE. solely responsible determining appropriateness using redistributing Work assume risks associated exercise permissions License.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_8-limitation-of-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"8. Limitation of Liability","title":"Apache License","text":"event legal theory, whether tort (including negligence), contract, otherwise, unless required applicable law (deliberate grossly negligent acts) agreed writing, shall Contributor liable damages, including direct, indirect, special, incidental, consequential damages character arising result License use inability use Work (including limited damages loss goodwill, work stoppage, computer failure malfunction, commercial damages losses), even Contributor advised possibility damages.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"id_9-accepting-warranty-or-additional-liability","dir":"","previous_headings":"Terms and Conditions for use, reproduction, and distribution","what":"9. Accepting Warranty or Additional Liability","title":"Apache License","text":"redistributing Work Derivative Works thereof, may choose offer, charge fee , acceptance support, warranty, indemnity, liability obligations /rights consistent License. However, accepting obligations, may act behalf sole responsibility, behalf Contributor, agree indemnify, defend, hold Contributor harmless liability incurred , claims asserted , Contributor reason accepting warranty additional liability. END TERMS CONDITIONS","code":""},{"path":"https://novonordisk-opensource.github.io/connector/LICENSE.html","id":"appendix-how-to-apply-the-apache-license-to-your-work","dir":"","previous_headings":"","what":"APPENDIX: How to apply the Apache License to your work","title":"Apache License","text":"apply Apache License work, attach following boilerplate notice, fields enclosed brackets [] replaced identifying information. (Don’t include brackets!) text enclosed appropriate comment syntax file format. also recommend file class name description purpose included “printed page” copyright notice easier identification within third-party archives.","code":"Copyright 2024 Novo Nordisk A/S, Danish company registration no. 24256790 Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"connector","text":"vignette demonstrates use connector package connect either file system database access different types data. First let’s load packages ’re going use vignette: may notice ’re loading connector package, connector.databricks connector.sharepoint well. packages extend functionality connector package connect Databricks SharePoint, respectively.","code":"library(connector) library(connector.databricks) library(connector.sharepoint)"},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"connector-configuration","dir":"Articles","previous_headings":"","what":"Connector configuration","title":"connector","text":"Main function package connect(). function based configuration file list creates connectors() object connector specified datasources. configuration file can format can read read_file(), contains list. yaml file provided, expressions evaluated parsing using yaml::read_yaml() eval.expr = TRUE. input list (configuration file) following structure: metadata, env, connections, datasources fields allowed. elements must named. datasources mandatory. metadata env must list named character vectors length 1 specified. datasources must list unnamed lists. datasources must named character element name named list element backend connection backend.type must provided example configuration file different types connections: example multiple connections multiple data sources. ADaM data stored file system, metadata resides Databricks Tables, TFL also Databricks, Volumes, unstructured data stored. Finally, output stored SharePoint.","code":"metadata: trial: \"yyyy\" project: \"nnxxxx\" instance: \"current\" http_path: !!expr Sys.getenv(\"DATABRICKS_HTTP_PATH\") catalog: !!expr Sys.getenv(\"DATABRICKS_CATALOG_NAME\") sharepoint: \"https://my_organisation.sharepoint.com\" root_path: \"/home/my_root_path\" datasources: - name: \"adam\" backend: type: \"fs\" path: \"{root_path}/{project}/{trial}/{instance}/adam\" - name: \"tfl\" backend: type: \"connector.databricks::connector_databricks_volume\" catalog: \"{metadata.catalog}\" schema: \"{metadata.project}_{metadata.trial}_tfl\" path: \"output\" - name: \"metadata\" backend: type: \"connector.databricks::connector_databricks_dbi\" http_path: \"{metadata.http_path}\" catalog: \"{metadata.catalog}\" schema: \"{metadata.project}_{metadata.trial}_metadata\" - name: \"output_sh\" backend: type: \"connector.sharepoint::connector_sharepoint\" site_url: \"{metadata.sharepoint}/sites/{metadata.project}_{metadata.trial}_output\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"connect-to-datasources","dir":"Articles","previous_headings":"","what":"Connect to datasources","title":"connector","text":"want connect datasources can use connect() function. creates list connectors, can accessed names: setup done can use connections read write data datasources.","code":"# Load data connections db <- connect() # ADaM data db$adam # TFL data db$tfl # Metadata db$metadata # Output on SharePoint db$output_sh"},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"reading-and-writing-data","dir":"Articles","previous_headings":"","what":"Reading and writing data","title":"connector","text":"connector packages provide set functions read write data datasources. similar interface, ’s easy switch . Now, show read write different types data /different datasources. examples using iris mtcars datasets. example writing data ADaM table: Now, let’s read data back manipulate bit write SharePoint DataBricks. way can save different types data different formats.","code":"library(dplyr) # Manipulate data ## Iris data setosa <- iris |> filter(Species == \"setosa\") mean_for_all_iris <- iris |> group_by(Species) |> summarise_all(list(mean, median, sd, min, max)) ## Mtcars data cars <- mtcars |> filter(mpg > 22) mean_for_all_mtcars <- mtcars |> group_by(gear) |> summarise( across( everything(), list(\"mean\" = mean, \"median\" = median, \"sd\" = sd, \"min\" = min, \"max\" = max), .names = \"{.col}_{.fn}\") ) |> tidyr::pivot_longer( cols = -gear, names_to = c(\".value\", \"stat\"), names_sep = \"_\" ) ## Store data db$adam |> write_cnt(setosa, \"setosa\", overwrite = TRUE) db$adam |> write_cnt(mean_for_all_iris, \"mean_iris\", overwrite = TRUE) db$adam |> write_cnt(cars, \"cars_mpg\", overwrite = TRUE) db$adam |> write_cnt(mean_for_all_mtcars, \"mean_mtcars\", overwrite = TRUE) library(gt) library(tidyr) library(ggplot2) # List and load data db$adam |> list_content_cnt() table <- db$adam |> read_cnt(\"mean_mtcars\") gttable <- table |> gt(groupname_col = \"gear\") ## Save table db$tfl$write_cnt(gttable$`_data`, \"tmeanallmtcars.csv\") db$tfl$write_cnt(gttable, \"tmeanallmtcars.rds\") ## Using Sharepoint tmp_file <- tempfile(fileext = \".docx\") gtsave(gttable, tmp_file) db$output_sh$upload_cnt(tmp_file, \"tmeanallmtcars.docx\") # Manipulate data setosa_fsetosa <- db$adam |> read_cnt(\"setosa\") |> filter(Sepal.Length > 5) fsetosa <- ggplot(setosa) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point() ## Using Databricks Volumes ## Store Tfls db$tfl$write_cnt(fsetosa$data, \"fsetosa.csv\") db$tfl$write_cnt(fsetosa, \"fsetosa.rds\") ## Using Sharepoint tmp_file <- tempfile(fileext = \".png\") ggsave(tmp_file, fsetosa) db$output_sh$upload(tmp_file, \"fsetosa.png\") ## Using Databricks Volumes db$tfl$upload_cnt(contents = tmp_file, file_path = \"fsetosa.png\")"},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"working-example","dir":"Articles","previous_headings":"","what":"Working example","title":"connector","text":"example anyone can run see connector package works. use configuration file provided , use file system type connection ADaM TFL data. Now, let’s run example:","code":"metadata: adam_path: !expr file.path(tempdir(), \"adam\") tfl_path: !expr file.path(tempdir(), \"tfl\") datasources: - name: \"adam\" backend: type: \"connector_fs\" path: \"{metadata.adam_path}\" - name: \"tfl\" backend: type: \"connector_fs\" path: \"{metadata.tfl_path}\" library(connector) library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union library(ggplot2) # Let's create ADaM and TFL directories in temporary directory of the session dir.create(file.path(tempdir(), \"adam\")) dir.create(file.path(tempdir(), \"tfl\")) # Get example configuration from file config_file <- system.file(\"config\", \"config_file_system.yml\", package = \"connector\") # Load data connections db <- connect(config = config_file) #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /tmp/RtmpWsRGfM/adam #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → tfl #> • connector_fs #> • /tmp/RtmpWsRGfM/tfl ## Iris data setosa <- iris |> filter(Species == \"setosa\") mean_for_all_iris <- iris |> group_by(Species) |> summarise_all(list(mean, median, sd, min, max)) ## Store data db$adam |> write_cnt(setosa, \"setosa.rds\") db$adam |> write_cnt(mean_for_all_iris, \"mean_iris.rds\") ## List and load data db$adam |> list_content_cnt() #> [1] \"mean_iris.rds\" \"setosa.rds\" # Manipulate data setosa_fsetosa <- db$adam |> read_cnt(\"setosa\") |> filter(Sepal.Length > 5) fsetosa <- ggplot(setosa) + aes(x = Sepal.Length, y = Sepal.Width) + geom_point() ## Store Tfls db$tfl$write_cnt(fsetosa$data, \"fsetosa.csv\") db$tfl$write_cnt(fsetosa, \"fsetosa.rds\") ## Store images tmp_file <- tempfile(fileext = \".png\") ggsave(tmp_file, fsetosa) #> Saving 7.29 x 4.51 in image db$tfl$upload_cnt(tmp_file, \"fsetosa.png\") # Check if everything is written into temporary TFL directory db$tfl$list_content_cnt() #> [1] \"fsetosa.csv\" \"fsetosa.png\" \"fsetosa.rds\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/connector.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"connector","text":"vignette showed connect different datasources, read write data . used connector.databricks connector.sharepoint packages extend functionality connector package connect Databricks SharePoint, respectively. package designed extensible, new data sources can added easily.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"creating-a-new-connector","dir":"Articles","previous_headings":"","what":"Creating a new connector","title":"How to extend connector","text":"can create new connector creating new R6 class inherits connector: simplest type inheritance, note connector parent class methods capable e.g. reading (read_cnt()) writing (write_cnt()) data. default methods throws meaningful errors defined method (e.g. write_cnt.my_class()) new connector class. cases want inherit either connector_fs() connector_dbi() depending new connector used access files databases respectively. create new connector_project class inherits acts exactly connector_fs(), instead user provide path folder argument, provide project name, path constructed . way extending connector e.g. relevant inside organisation projects stored common folder structure. initialize connector_project can see still methods connector_fs(), path assigned correctly based project argument: can now use connector read write data, just connector_fs():","code":"connector_myclass <- R6::R6Class( \"connector_myclass\", inherit = connector ) connector_myclass$new() #> #> Inherits from: connector_project <- R6::R6Class( \"connector_project\", inherit = connector_fs, public = list( initialize = function(project) { private$.project <- project path <- file.path(\"my_root_path\", project) super$initialize(path) } ), private = list( .project = NULL ), active = list( project = function() { private$.project } ) ) my_project <- connector_project$new(project = \"my_project\") print(my_project) #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project #> • project: my_project # First list current content: my_project |> list_content_cnt() #> character(0) # Write some content: my_project |> write_cnt(\"Hello world!\", \"my_file.txt\") # List content again: my_project |> list_content_cnt() #> [1] \"my_file.txt\" # Read the content: my_project |> read_cnt(\"my_file.txt\") #> [1] \"Hello world!\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"create-custom-generic-method","dir":"Articles","previous_headings":"","what":"Create custom generic method","title":"How to extend connector","text":"connectorgenerics list_content_cnt(), read_cnt(), write_cnt() S3 generics. means can create custom methods new connector class, used generic called, instead one associated parent class. illustrate can take look list_content_cnt() generic: Building example can define custom method list_content_cnt() connector_project class, used instead list_content_cnt.connector_fs(): course simple example, just prints message calling connector_fs method. can now see method available associated connector_project class: use list_content_cnt() my_project object, see custom method used get message:","code":"# Print the generic print(list_content_cnt) #> function (connector_object, ...) #> { #> UseMethod(\"list_content_cnt\") #> } #> #> # List the registered s3 methods methods(\"list_content_cnt\") |> cat(sep = \"\\n\") #> list_content_cnt.connector_dbi #> list_content_cnt.connector_fs #> list_content_cnt.default list_content_cnt.connector_project <- function(connector_object, ...) { cli::cli_alert(\"Listing content of {connector_object$project}\") NextMethod() } # List methods again methods(\"list_content_cnt\") |> cat(sep = \"\\n\") #> list_content_cnt.connector_dbi #> list_content_cnt.connector_fs #> list_content_cnt.connector_project #> list_content_cnt.default # Print my_project connector to see associated methods print(my_project) #> #> Inherits from: #> Registered methods: #> • `list_content_cnt.connector_project()` #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project #> • project: my_project my_project |> list_content_cnt() #> → Listing content of my_project #> [1] \"my_file.txt\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"use-extra-class-for-simple-customization","dir":"Articles","previous_headings":"","what":"Use extra class for simple customization","title":"How to extend connector","text":"just want slightly tweak behavior existing functionality alternative solution use extra_class argument initializing connector. argument adds extra_class first class creating connector, meaning generic dispatch, list_content_cnt(), method class used connector classes. redo two examples make new connector_fs extra class demo_extra: can see methods connector_fs(), demo_extra now first class class hierarchy. create custom method list_content_cnt() demo_extra connector_project : project information course available now, just print path instead, otherwise everything :","code":"my_project_extra <- connector_fs$new( path = \"my_root_path/my_project\", extra_class = \"my_extra_class\" ) print(my_project_extra) #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project list_content_cnt.my_extra_class <- function(connector_object, ...) { cli::cli_alert(\"Listing content of {connector_object$path}\") NextMethod() } # List methods methods(\"list_content_cnt\") #> [1] list_content_cnt.connector_dbi* list_content_cnt.connector_fs* #> [3] list_content_cnt.connector_project list_content_cnt.default* #> [5] list_content_cnt.my_extra_class #> see '?methods' for accessing help and source code # Print my_project_extra connector to see associated methods print(my_project_extra) #> #> Inherits from: #> Registered methods: #> • `list_content_cnt.my_extra_class()` #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: my_root_path/my_project # List content to see the new message my_project_extra |> list_content_cnt() #> → Listing content of my_root_path/my_project #> [1] \"my_file.txt\""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"special-handling-of-files","dir":"Articles","previous_headings":"","what":"Special handling of files","title":"How to extend connector","text":"special property file storage connectors (inheriting connector_fs()) operating files databases. means can handle multiple file formats, also file formats reading writing rectangular data. handling files user use read_cnt() write_cnt() generics, behind scenes following chain functions called: read_cnt() –> read_file() –> read_ext() –> External read function write_cnt() –> write_file() –> write_ext() –> External write function read_cnt() dispatches based class connector object. file storage connectors (inheriting connector_fs()) read_file() method called path file. read_file() helper function, calls read_ext() generic dispatches based file extension file, uses general functions packages read file. example file extension .csv read using readr::read_csv(). logic applies write_cnt().","code":""},{"path":"https://novonordisk-opensource.github.io/connector/articles/customize.html","id":"add-new-file-format","dir":"Articles","previous_headings":"Special handling of files","what":"Add new file format","title":"How to extend connector","text":"currently supported file types can seen reference read_cnt() write_cnt() functions respectively. let us imagine want support new imaginary file format myformat. order need create appropriate read_ext() write_ext() methods: can now use write read new file format existing my_project connector:","code":"read_ext.myformat <- function(path, ...) { cli::cli_alert(\"Reading myformat file\") readLines(con = path) } write_ext.myformat <- function(file, x, ...) { cli::cli_alert(\"Writing myformat file\") writeLines(text = x, con = file) } # List already existing content: my_project |> list_content_cnt() #> → Listing content of my_project #> [1] \"my_file.txt\" # Write some content in myformat: my_project |> write_cnt(\"Hello new format!\", \"new_file.myformat\") #> → Writing myformat file # List content again: my_project |> list_content_cnt() #> → Listing content of my_project #> [1] \"my_file.txt\" \"new_file.myformat\" # Read the content: my_project |> read_cnt(\"new_file.myformat\") #> → Reading myformat file #> [1] \"Hello new format!\""},{"path":"https://novonordisk-opensource.github.io/connector/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Cervan Girard. Author, maintainer. Aksel Thomsen. Author. Novo Nordisk /S. Copyright holder.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Girard C, Thomsen (2024). connector: Connect data easily. R package version 0.0.4.9000, https://github.com/novonordisk-opensource/connector, https://novonordisk-opensource.github.io/connector.","code":"@Manual{, title = {connector: Connect to your data easily}, author = {Cervan Girard and Aksel Thomsen}, year = {2024}, note = {R package version 0.0.4.9000, https://github.com/novonordisk-opensource/connector}, url = {https://novonordisk-opensource.github.io/connector}, }"},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/index.html","id":"overview","dir":"","previous_headings":"","what":"Overview","title":"Connect to your data easily","text":"connector provides seamless consistent interface connecting different data sources, simple file storage systems databases. also gives option use central configuration file manage connections project, ensures consistent reference data source across different scripts project, enables easily switch different data sources. connector package comes possibilities creating connections file system folders using connector_fs() general databases using connector_dbi(), built top DBI package. connector also series expansion packages allows easily connect specific data sources: {connector.databricks}: Connect Databricks {connector.sharepoint}: Connect SharePoint sites connector.logger: Log connector actions, see also whirl log scripts","code":""},{"path":"https://novonordisk-opensource.github.io/connector/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"Connect to your data easily","text":"recommended way using connector specify common yaml configuration file project contains connection details data sources. simple example creating connectors folder database shown : _connector.yml: First specify common metadata connectors, temporary folder want use. Afterwards specify datasources needed project, specifications. first name “folder”, specify type connector_fs(), path folder. second database connector memory SQLite database, specify using connector_dbi() type, uses DBI::dbConnect() initalize connection. Therefor also give DBI driver use, arguments . connect create conenctors use connect() configuration file input: creates connectors objects contains connector. printing individual conenctor get general information methods specifications. now ready use connectors, can start writing data folder one: parquet format used, using connector_fs() possible read write several different file types. See read_file() write_file() information. database connector works way:","code":"metadata: path: !expr withr::local_tempdir() datasources: - name: \"folder\" backend: type: \"connector_fs\" path: \"{metadata.path}\" - name: \"database\" backend: type: \"connector_dbi\" drv: \"RSQLite::SQLite()\" dbname: \":memory:\" library(connector) db <- connect(\"_connector.yml\") #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → folder #> • connector_fs #> • /var/folders/fx/71by3f551qzb5wkxt82cv15m0000gp/T//RtmpfTSxQB/file1c1d28730925 #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → database #> • connector_dbi #> • RSQLite::SQLite() and :memory: print(db) #> #> $folder #> $database print(db$database) #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: # Initially it is empty db$folder |> list_content_cnt() #> character(0) # Create some data cars <- mtcars |> tibble::as_tibble(rownames = \"car\") # Write to folder as a parquet file db$folder |> write_cnt(x = cars, name = \"cars.parquet\") # Now the folder contains the file db$folder |> list_content_cnt() #> [1] \"cars.parquet\" # And we can read it back in db$folder |> read_cnt(name = \"cars.parquet\") #> # A tibble: 32 × 12 #> car mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 Mazda RX4 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 Mazda RX4 … 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 Datsun 710 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 #> 4 Hornet 4 D… 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 5 Hornet Spo… 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 6 Valiant 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> 7 Duster 360 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 8 Merc 240D 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 #> 9 Merc 230 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 #> 10 Merc 280 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> # ℹ 22 more rows # Initially no tables exists db$database |> list_content_cnt() #> character(0) # Write cars to the database as a table db$database |> write_cnt(x = cars, name = \"cars\") # Now the cara table exists db$database |> list_content_cnt() #> [1] \"cars\" # And we can read it back in db$database |> read_cnt(name = \"cars\") |> dplyr::as_tibble() #> # A tibble: 32 × 12 #> car mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 Mazda RX4 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 Mazda RX4 … 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 Datsun 710 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 #> 4 Hornet 4 D… 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 5 Hornet Spo… 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 6 Valiant 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> 7 Duster 360 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 8 Merc 240D 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 #> 9 Merc 230 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 #> 10 Merc 280 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> # ℹ 22 more rows"},{"path":"https://novonordisk-opensource.github.io/connector/index.html","id":"useful-links","dir":"","previous_headings":"","what":"Useful links","title":"Connect to your data easily","text":"information use package, see following links: connect() documentation specify configuration file vignette(\"connector\") examples use package vignette(\"customize\") create connector customize behavior NovoNordisk-OpenSource/R-packages overview connector R packages published Novo Nordisk","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect to datasources specified in a config file — connect","title":"Connect to datasources specified in a config file — connect","text":"Based configuration file list functions creates connectors() object connector specified datasources. configuration file can format can read read_file(), contains list. yaml file provided, expressions evaluated parsing using yaml::read_yaml() eval.expr = TRUE. See also vignette(\"connector\") use configuration files project, details required structure configuration.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect to datasources specified in a config file — connect","text":"","code":"connect( config = \"_connector.yml\", metadata = NULL, datasource = NULL, set_env = TRUE, logging = FALSE )"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect to datasources specified in a config file — connect","text":"config character path connector config file list specifications metadata list Replace, add create elements metadata field found config datasource character Name(s) datasource(s) connect . NULL (default) datasources connected. set_env logical environment variables yaml file set? Default TRUE. logging logical Add logs console well whirl log html files. See details vignette.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Connect to datasources specified in a config file — connect","text":"connectors","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Connect to datasources specified in a config file — connect","text":"input list can specified two ways: named list containing specifications single connectors object. unnamed list, element structure 1., returns nested connectors object. See example . specification single connectors following structure: name, metadata, env datasources allowed. elements must named. name required using nested connectors. datasources mandatory. metadata env must list named character vectors length 1 specified. datasources must list unnamed lists. datasource must named character element name named list element backend connection backend.type must provided","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect to datasources specified in a config file — connect","text":"","code":"config <- system.file(\"config\", \"default_config.yml\", package = \"connector\") config #> [1] \"/home/runner/work/_temp/Library/connector/config/default_config.yml\" # Show the raw configuration file readLines(config) |> cat(sep = \"\\n\") #> # A example of the configuration file for FS and Database #> metadata: #> trial: \"demo_trial\" #> root_path: !expr system.file(package = \"connector\") #> extra_class: \"test2\" #> #> datasources: #> - name: \"adam\" #> backend: #> type: \"connector_fs\" #> path: \"{metadata.root_path}/{metadata.trial}/adam\" #> extra_class: \"{metadata.extra_class}\" #> - name: \"sdtm\" #> backend: #> type: \"connector_dbi\" #> drv: \"RSQLite::SQLite()\" #> dbname: \":memory:\" # Connect to the datasources specified in it cnts <- connect(config) #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam and test2 #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → sdtm #> • connector_dbi #> • RSQLite::SQLite() and :memory: cnts #> #> $adam #> $sdtm # Content of each connector cnts$adam #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: /home/runner/work/_temp/Library/connector/demo_trial/adam cnts$sdtm #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: # Overwrite metadata informations connect(config, metadata = list(extra_class = \"my_class\")) #> ℹ Replace some metadata informations... #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam and my_class #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → sdtm #> • connector_dbi #> • RSQLite::SQLite() and :memory: #> #> $adam #> $sdtm # Connect only to the adam datasource connect(config, datasource = \"adam\") #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam and test2 #> #> $adam # Connect to several projects in a nested structure config_nested <- system.file(\"config\", \"_connector_nested.yml\", package = \"connector\") readLines(config_nested) |> cat(sep = \"\\n\") #> # A example of the configuration file nested connectors #> - name: \"study1\" #> metadata: #> trial: \"demo_trial\" #> root_path: !expr system.file(package = \"connector\") #> datasources: #> - name: \"adam_fs\" #> backend: #> type: \"connector_fs\" #> path: \"{metadata.root_path}/{metadata.trial}/adam\" #> #> - name: \"study2\" #> metadata: #> trial: \"demo_trial\" #> root_path: !expr system.file(package = \"connector\") #> datasources: #> - name: \"adam_fs\" #> backend: #> type: \"connector_fs\" #> path: \"{metadata.root_path}/{metadata.trial}/adam\" cnts_nested <- connect(config_nested) #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam_fs #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam #> ──────────────────────────────────────────────────────────────────────────────── #> Connection to: #> → adam_fs #> • connector_fs #> • /home/runner/work/_temp/Library/connector/demo_trial/adam cnts_nested #> #> $study1 #> $study2 cnts_nested$study1 #> #> $adam_fs "},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector-package.html","id":null,"dir":"Reference","previous_headings":"","what":"connector: Connect to your data easily — connector-package","title":"connector: Connect to your data easily — connector-package","text":"connector package helps connecting R databases contains ADAM, STDM . package defines interface can reused databases.","code":""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"connector: Connect to your data easily — connector-package","text":"Maintainer: Cervan Girard cgid@novonordisk.com Authors: Aksel Thomsen oath@novonordisk.com contributors: Novo Nordisk /S [copyright holder]","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":null,"dir":"Reference","previous_headings":"","what":"General connector object — connector","title":"General connector object — connector","text":"R6 class general class connectors. used define methods connectors . New connectors inherit class, methods described implemented.","code":""},{"path":[]},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"General connector object — connector","text":"connector$new() connector$print() connector$list_content_cnt() connector$read_cnt() connector$write_cnt() connector$remove_cnt() connector$clone()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"General connector object — connector","text":"Initialize connector option adding extra class.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$new(extra_class = NULL)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"extra_class character Extra class assign new connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-print-","dir":"Reference","previous_headings":"","what":"Method print()","title":"General connector object — connector","text":"Print method connector showing registered methods specifications active bindings.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$print()"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-list-content-cnt-","dir":"Reference","previous_headings":"","what":"Method list_content_cnt()","title":"General connector object — connector","text":"List available content connector. See also list_content_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$list_content_cnt(...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"character vector content names","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-read-cnt-","dir":"Reference","previous_headings":"","what":"Method read_cnt()","title":"General connector object — connector","text":"Read content connector. See also read_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$read_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-2","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"R object content. rectangular data data.frame.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-write-cnt-","dir":"Reference","previous_headings":"","what":"Method write_cnt()","title":"General connector object — connector","text":"Write content connector.See also write_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$write_cnt(x, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-3","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"x object write connection name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-3","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-remove-cnt-","dir":"Reference","previous_headings":"","what":"Method remove_cnt()","title":"General connector object — connector","text":"Remove delete content connector. See also remove_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$remove_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-4","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"returns-4","dir":"Reference","previous_headings":"","what":"Returns","title":"General connector object — connector","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"General connector object — connector","text":"objects class cloneable method.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"usage-6","dir":"Reference","previous_headings":"","what":"Usage","title":"General connector object — connector","text":"","code":"connector$clone(deep = FALSE)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"arguments-5","dir":"Reference","previous_headings":"","what":"Arguments","title":"General connector object — connector","text":"deep Whether make deep clone.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"General connector object — connector","text":"","code":"# Create connector cnt <- connector$new() cnt #> # Standard error message if no method is implemented cnt |> read_cnt(\"fake_data\") |> try() #> Error in read_cnt(cnt, \"fake_data\") : #> Method not implemented for class #> ℹ See the customize (`vignette(connector::customize)`) vignette on how to #> create custom connectors and methods # Connection with extra class cnt_my_class <- connector$new(extra_class = \"my_class\") cnt_my_class #> # Custom method for the extra class read_cnt.my_class <- function(connector_object) \"Hello!\" registerS3method(\"read_cnt\", \"my_class\", \"read_cnt.my_class\") cnt_my_class #> #> Registered methods: #> • `read_cnt.my_class()` read_cnt(cnt_my_class) #> [1] \"Hello!\""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":null,"dir":"Reference","previous_headings":"","what":"Connector for DBI databases — connector_dbi","title":"Connector for DBI databases — connector_dbi","text":"Connector object DBI connections. object used interact DBI compliant database backends. See DBI package backends supported.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Connector for DBI databases — connector_dbi","text":"Upon garbage collection, connection try disconnect database. good practice call disconnect_cnt done connection.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"super-class","dir":"Reference","previous_headings":"","what":"Super class","title":"Connector for DBI databases — connector_dbi","text":"connector::connector -> connector_dbi","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"active-bindings","dir":"Reference","previous_headings":"","what":"Active bindings","title":"Connector for DBI databases — connector_dbi","text":"conn DBI connection. Inherits DBI::DBIConnector","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Connector for DBI databases — connector_dbi","text":"connector::connector$list_content_cnt() connector::connector$print() connector::connector$read_cnt() connector::connector$remove_cnt() connector::connector$write_cnt()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"Connector for DBI databases — connector_dbi","text":"connector_dbi$new() connector_dbi$disconnect_cnt() connector_dbi$tbl_cnt() connector_dbi$clone()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"Connector for DBI databases — connector_dbi","text":"Initialize connection","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$new(drv, ..., extra_class = NULL)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for DBI databases — connector_dbi","text":"drv Driver object inheriting DBI::DBIDriver. ... Additional arguments passed DBI::dbConnect(). extra_class character Extra class assign new connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-disconnect-cnt-","dir":"Reference","previous_headings":"","what":"Method disconnect_cnt()","title":"Connector for DBI databases — connector_dbi","text":"Disconnect database. See also disconnect_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$disconnect_cnt()"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for DBI databases — connector_dbi","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-tbl-cnt-","dir":"Reference","previous_headings":"","what":"Method tbl_cnt()","title":"Connector for DBI databases — connector_dbi","text":"Use dplyr verbs interact remote database table. See also tbl_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$tbl_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for DBI databases — connector_dbi","text":"name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for DBI databases — connector_dbi","text":"dplyr::tbl object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"Connector for DBI databases — connector_dbi","text":"objects class cloneable method.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for DBI databases — connector_dbi","text":"","code":"connector_dbi$clone(deep = FALSE)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for DBI databases — connector_dbi","text":"deep Whether make deep clone.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_dbi.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connector for DBI databases — connector_dbi","text":"","code":"# Create DBI connector cnt <- connector_dbi$new(RSQLite::SQLite(), \":memory:\") cnt #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: # Write to the database cnt$write_cnt(iris, \"iris\") # Read from the database cnt$read_cnt(\"iris\") |> head() #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa # List available tables cnt$list_content_cnt() #> [1] \"iris\" # Use the connector to run a query cnt$conn #> #> Path: :memory: #> Extensions: TRUE cnt$conn |> DBI::dbGetQuery(\"SELECT * FROM iris limit 5\") #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa # Use dplyr verbs and collect data cnt$tbl_cnt(\"iris\") |> dplyr::filter(Sepal.Length > 7) |> dplyr::collect() #> # A tibble: 12 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 7.1 3 5.9 2.1 virginica #> 2 7.6 3 6.6 2.1 virginica #> 3 7.3 2.9 6.3 1.8 virginica #> 4 7.2 3.6 6.1 2.5 virginica #> 5 7.7 3.8 6.7 2.2 virginica #> 6 7.7 2.6 6.9 2.3 virginica #> 7 7.7 2.8 6.7 2 virginica #> 8 7.2 3.2 6 1.8 virginica #> 9 7.2 3 5.8 1.6 virginica #> 10 7.4 2.8 6.1 1.9 virginica #> 11 7.9 3.8 6.4 2 virginica #> 12 7.7 3 6.1 2.3 virginica # Disconnect from the database cnt$disconnect_cnt()"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":null,"dir":"Reference","previous_headings":"","what":"Connector for file storage — connector_fs","title":"Connector for file storage — connector_fs","text":"connector_fs class file storage connector accessing manipulating files file storage solution. default implementation includes methods files stored local network drives.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"super-class","dir":"Reference","previous_headings":"","what":"Super class","title":"Connector for file storage — connector_fs","text":"connector::connector -> connector_fs","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"active-bindings","dir":"Reference","previous_headings":"","what":"Active bindings","title":"Connector for file storage — connector_fs","text":"path character Path file storage","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Connector for file storage — connector_fs","text":"connector::connector$list_content_cnt() connector::connector$print() connector::connector$read_cnt() connector::connector$remove_cnt() connector::connector$write_cnt()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"Connector for file storage — connector_fs","text":"connector_fs$new() connector_fs$download_cnt() connector_fs$upload_cnt() connector_fs$create_directory_cnt() connector_fs$remove_directory_cnt() connector_fs$clone()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"Connector for file storage — connector_fs","text":"Initializes connector file storage.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$new(path, extra_class = NULL)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"path character Path file storage extra_class character Extra class added Checked using checkmate::assert_directory_exists.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-download-cnt-","dir":"Reference","previous_headings":"","what":"Method download_cnt()","title":"Connector for file storage — connector_fs","text":"Download content file storage. See also download_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$download_cnt(name, file = basename(name), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"name character Name content read, write, remove. Typically table name. file character Path file download upload ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"invisible file","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-upload-cnt-","dir":"Reference","previous_headings":"","what":"Method upload_cnt()","title":"Connector for file storage — connector_fs","text":"Upload file file storage. See also upload_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$upload_cnt(file, name = basename(file), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"file character Path file download upload name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns-1","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-create-directory-cnt-","dir":"Reference","previous_headings":"","what":"Method create_directory_cnt()","title":"Connector for file storage — connector_fs","text":"Create directory file storage. See also create_directory_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$create_directory_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-3","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"name character name directory create ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns-2","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"connector_fs object newly created directory","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-remove-directory-cnt-","dir":"Reference","previous_headings":"","what":"Method remove_directory_cnt()","title":"Connector for file storage — connector_fs","text":"Remove directory file storage. See also remove_directory_cnt.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-4","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$remove_directory_cnt(name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-4","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"name character name directory remove ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"returns-3","dir":"Reference","previous_headings":"","what":"Returns","title":"Connector for file storage — connector_fs","text":"invisible self.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"Connector for file storage — connector_fs","text":"objects class cloneable method.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"usage-5","dir":"Reference","previous_headings":"","what":"Usage","title":"Connector for file storage — connector_fs","text":"","code":"connector_fs$clone(deep = FALSE)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"arguments-5","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connector for file storage — connector_fs","text":"deep Whether make deep clone.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connector_fs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connector for file storage — connector_fs","text":"","code":"# Create file storage connector cnt <- connector_fs$new(tempdir()) cnt #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: /tmp/RtmptTicCA # List content cnt$list_content_cnt() #> [1] \"bslib-60b44f9663e91341c79e0df466adbe7c\" #> [2] \"downlit\" #> [3] \"file183213b6b282\" #> [4] \"file1832182185e7\" #> [5] \"file18327abc6b5f\" #> [6] \"file1832879294d\" #> [7] \"repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds\" # Write to the connector cnt$write_cnt(iris, \"iris.rds\") # Check it is there cnt$list_content_cnt() #> [1] \"bslib-60b44f9663e91341c79e0df466adbe7c\" #> [2] \"downlit\" #> [3] \"file183213b6b282\" #> [4] \"file1832182185e7\" #> [5] \"file18327abc6b5f\" #> [6] \"file1832879294d\" #> [7] \"iris.rds\" #> [8] \"repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds\" # Read the result back cnt$read_cnt(\"iris.rds\") |> head() #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":null,"dir":"Reference","previous_headings":"","what":"Collection of connector objects — connectors","title":"Collection of connector objects — connectors","text":"Holds special list individual connector objects consistent use connections project.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Collection of connector objects — connectors","text":"","code":"connectors(...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Collection of connector objects — connectors","text":"... Named individual connector objects","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/connectors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Collection of connector objects — connectors","text":"","code":"# Create connectors objects con <- connectors( sdtm = connector_fs$new(path = tempdir()), adam = connector_dbi$new(drv = RSQLite::SQLite()) ) # Print for overview con #> #> $sdtm #> $adam # Print the individual connector for more information con$sdtm #> #> Inherits from: #> Registered methods: #> • `create_directory_cnt.connector_fs()` #> • `download_cnt.connector_fs()` #> • `list_content_cnt.connector_fs()` #> • `read_cnt.connector_fs()` #> • `remove_cnt.connector_fs()` #> • `remove_directory_cnt.connector_fs()` #> • `upload_cnt.connector_fs()` #> • `write_cnt.connector_fs()` #> Specifications: #> • path: /tmp/RtmptTicCA con$adam #> #> Inherits from: #> Registered methods: #> • `disconnect_cnt.connector_dbi()` #> • `list_content_cnt.connector_dbi()` #> • `read_cnt.connector_dbi()` #> • `remove_cnt.connector_dbi()` #> • `tbl_cnt.connector_dbi()` #> • `write_cnt.connector_dbi()` #> Specifications: #> • conn: "},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a directory — create_directory_cnt","title":"Create a directory — create_directory_cnt","text":"Generic implementing create directory connector. Mostly relevant file storage connectors. connector_fs: Uses dir.create() create directory path connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a directory — create_directory_cnt","text":"","code":"create_directory_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' create_directory_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a directory — create_directory_cnt","text":"connector_object connector connector object use. name character name directory create ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a directory — create_directory_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/create_directory_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a directory — create_directory_cnt","text":"","code":"# Create a directory in a file storage cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt(pattern = \"new_folder\") #> character(0) cnt |> create_directory_cnt(\"new_folder\") # This will return new connector object of a newly created folder new_connector <- cnt |> list_content_cnt(pattern = \"new_folder\") cnt |> remove_directory_cnt(\"new_folder\")"},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Disconnect (close) the connection of the connector — disconnect_cnt","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"Generic implementing disconnect relevant connections. Mostly relevant DBI connectors. connector_dbi: Uses DBI::dbDisconnect() create table reference close DBI connection.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"","code":"disconnect_cnt(connector_object, ...) # S3 method for class 'connector_dbi' disconnect_cnt(connector_object, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"connector_object connector connector object use. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/disconnect_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disconnect (close) the connection of the connector — disconnect_cnt","text":"","code":"# Open and close a DBI connector cnt <- connector_dbi$new(RSQLite::SQLite()) cnt$conn #> #> Path: #> Extensions: TRUE cnt |> disconnect_cnt() cnt$conn #> #> DISCONNECTED"},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Download content from the connector — download_cnt","title":"Download content from the connector — download_cnt","text":"Generic implementing download files connector: connector_fs: Uses file.copy() copy file file storage desired file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Download content from the connector — download_cnt","text":"","code":"download_cnt(connector_object, name, file = basename(name), ...) # S3 method for class 'connector_fs' download_cnt(connector_object, name, file = basename(name), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Download content from the connector — download_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. file character Path file download upload ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Download content from the connector — download_cnt","text":"invisible file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/download_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Download content from the connector — download_cnt","text":"","code":"# Download file from a file storage cnt <- connector_fs$new(tempdir()) cnt |> write_cnt(\"this is an example\", \"example.txt\") list.files(pattern = \"example.txt\") #> character(0) cnt |> download_cnt(\"example.txt\") list.files(pattern = \"example.txt\") #> [1] \"example.txt\" readLines(\"example.txt\") #> [1] \"this is an example\" cnt |> remove_cnt(\"example.txt\")"},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"List available content from the connector — list_content_cnt","title":"List available content from the connector — list_content_cnt","text":"Generic implementing list content available different connectors: connector_dbi: Uses DBI::dbListTables() list tables DBI connection. connector_fs: Uses list.files() list files path connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List available content from the connector — list_content_cnt","text":"","code":"list_content_cnt(connector_object, ...) # S3 method for class 'connector_dbi' list_content_cnt(connector_object, ...) # S3 method for class 'connector_fs' list_content_cnt(connector_object, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List available content from the connector — list_content_cnt","text":"connector_object connector connector object use. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List available content from the connector — list_content_cnt","text":"character vector content names","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/list_content_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List available content from the connector — list_content_cnt","text":"","code":"# List tables in a DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> list_content_cnt() #> character(0) # List content in a file storage cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt() #> [1] \"bslib-60b44f9663e91341c79e0df466adbe7c\" #> [2] \"downlit\" #> [3] \"file183213b6b282\" #> [4] \"file1832182185e7\" #> [5] \"file18323c075c3d\" #> [6] \"file18327abc6b5f\" #> [7] \"file1832879294d\" #> [8] \"iris.rds\" #> [9] \"repos_https%3A%2F%2Fpackagemanager.posit.co%2Fcran%2F__linux__%2Fjammy%2Flatest%2Fsrc%2Fcontrib.rds\" # Only list CSV files using the pattern argument of list.files cnt |> list_content_cnt(pattern = \"\\\\.csv$\") #> character(0)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/options.html","id":null,"dir":"Reference","previous_headings":"","what":"connector Options — options","title":"connector Options — options","text":"Internally used, package-specific options. options prioritize R options() values, fall back environment variables undefined. neither option environment variable set, default value used.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/options.html","id":"checking-option-values","dir":"Reference","previous_headings":"","what":"Checking Option Values","title":"connector Options — options","text":"Option values specific connector can accessed passing package name env.","code":"options::opts(env = \"connector\") options::opt(x, default, env = \"connector\")"},{"path":"https://novonordisk-opensource.github.io/connector/reference/options.html","id":"options","dir":"Reference","previous_headings":"","what":"Options","title":"connector Options — options","text":"verbosity_level default: \"verbose\" option: connector.verbosity_level envvar: R_CONNECTOR_VERBOSITY_LEVEL (evaluated possible, raw string otherwise)","code":"\"verbose\""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/reference/options_params.html","id":null,"dir":"Reference","previous_headings":"","what":"Internal reuse of options description — options_params","title":"Internal reuse of options description — options_params","text":"Internal reuse options description","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/options_params.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Internal reuse of options description — options_params","text":"verbosity_level chatty log ? Possibilities quiet, verbose, debug. (Defaults \"verbose\", overwritable using option 'connector.verbosity_level' environment variable 'R_CONNECTOR_VERBOSITY_LEVEL')","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Read content from the connector — read_cnt","title":"Read content from the connector — read_cnt","text":"Generic implementing read content different connector objects: connector_dbi: Uses DBI::dbReadTable() read table DBI connection. connector_fs: Uses read_file() read given file. underlying function used, thereby also arguments available ... depends file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read content from the connector — read_cnt","text":"","code":"read_cnt(connector_object, name, ...) # S3 method for class 'connector_dbi' read_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' read_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read content from the connector — read_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read content from the connector — read_cnt","text":"R object content. rectangular data data.frame.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read content from the connector — read_cnt","text":"","code":"# Read table from DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> write_cnt(iris, \"iris\") cnt |> list_content_cnt() #> [1] \"iris\" cnt |> read_cnt(\"iris\") |> head() #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3.0 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5.0 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa # Write and read a CSV file using the file storage connector cnt <- connector_fs$new(tempdir()) cnt |> write_cnt(iris, \"iris.csv\") cnt |> read_cnt(\"iris.csv\") |> head() #> Rows: 150 Columns: 5 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \",\" #> chr (1): Species #> dbl (4): Sepal.Length, Sepal.Width, Petal.Length, Petal.Width #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. #> # A tibble: 6 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa"},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Read files based on the extension — read_file","title":"Read files based on the extension — read_file","text":"read_file() backbone read_cnt methods, files read source. function wrapper around read_ext(), controls dispatch based file extension. read_ext() controls packages functions used read individual file extensions. list pre-defined methods: default: extensions listed attempted read vroom::vroom() txt: readr::read_lines() csv: readr::read_csv() parquet: arrow::read_parquet() rds: readr::read_rds() sas7bdat: haven::read_sas() xpt: haven::read_xpt() yml/yaml: yaml::read_yaml() json: jsonlite::read_json()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read files based on the extension — read_file","text":"","code":"read_file(path, ...) read_ext(path, ...) # Default S3 method read_ext(path, ...) # S3 method for class 'txt' read_ext(path, ...) # S3 method for class 'csv' read_ext(path, ...) # S3 method for class 'parquet' read_ext(path, ...) # S3 method for class 'rds' read_ext(path, ...) # S3 method for class 'sas7bdat' read_ext(path, ...) # S3 method for class 'xpt' read_ext(path, ...) # S3 method for class 'yml' read_ext(path, ...) # S3 method for class 'json' read_ext(path, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read files based on the extension — read_file","text":"path character() Path file. ... parameters passed functions behind methods file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read files based on the extension — read_file","text":"result reading function","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/read_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read files based on the extension — read_file","text":"","code":"# Read CSV file temp_csv <- tempfile(\"iris\", fileext = \".csv\") write.csv(iris, temp_csv, row.names = FALSE) read_file(temp_csv) #> Rows: 150 Columns: 5 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \",\" #> chr (1): Species #> dbl (4): Sepal.Length, Sepal.Width, Petal.Length, Petal.Width #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. #> # A tibble: 150 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ℹ 140 more rows"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove content from the connector — remove_cnt","title":"Remove content from the connector — remove_cnt","text":"Generic implementing remove content different connectors: connector_dbi: Uses DBI::dbRemoveTable() remove table DBI connection. connector_fs: Uses unlink() delete file.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove content from the connector — remove_cnt","text":"","code":"remove_cnt(connector_object, name, ...) # S3 method for class 'connector_dbi' remove_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' remove_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove content from the connector — remove_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove content from the connector — remove_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove content from the connector — remove_cnt","text":"","code":"# Remove table in a DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> write_cnt(iris, \"iris\") |> list_content_cnt() #> [1] \"iris\" cnt |> remove_cnt(\"iris\") |> list_content_cnt() #> character(0) # Remove a file from the file storage cnt <- connector_fs$new(tempdir()) cnt |> write_cnt(\"this is an example\", \"example.txt\") cnt |> list_content_cnt(pattern = \"example.txt\") #> [1] \"example.txt\" cnt |> read_cnt(\"example.txt\") #> [1] \"this is an example\" cnt |> remove_cnt(\"example.txt\") cnt |> list_content_cnt(pattern = \"example.txt\") #> character(0)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove a directory — remove_directory_cnt","title":"Remove a directory — remove_directory_cnt","text":"Generic implementing remove directory connector. Mostly relevant file storage connectors. connector_fs: Uses unlink() recursive = TRUE remove directory path connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove a directory — remove_directory_cnt","text":"","code":"remove_directory_cnt(connector_object, name, ...) # S3 method for class 'connector_fs' remove_directory_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove a directory — remove_directory_cnt","text":"connector_object connector connector object use. name character name directory remove ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove a directory — remove_directory_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/remove_directory_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove a directory — remove_directory_cnt","text":"","code":"# Remove a directory from a file storage cnt <- connector_fs$new(tempdir()) cnt |> create_directory_cnt(\"new_folder\") cnt |> list_content_cnt(pattern = \"new_folder\") #> [1] \"new_folder\" cnt |> remove_directory_cnt(\"new_folder\") |> list_content_cnt(pattern = \"new_folder\") #> character(0)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Use dplyr verbs to interact with the remote database table — tbl_cnt","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"Generic implementing create dplyr::tbl() connection order use dplyr verbs interact remote database table. Mostly relevant DBI connectors. connector_dbi: Uses dplyr::tbl() create table reference table DBI connection.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"","code":"tbl_cnt(connector_object, name, ...) # S3 method for class 'connector_dbi' tbl_cnt(connector_object, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"connector_object connector connector object use. name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"dplyr::tbl object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/tbl_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use dplyr verbs to interact with the remote database table — tbl_cnt","text":"","code":"# Use dplyr verbs on a table in a DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) iris_cnt <- cnt |> write_cnt(iris, \"iris\") |> tbl_cnt(\"iris\") iris_cnt #> # Source: table<`iris`> [?? x 5] #> # Database: sqlite 3.47.1 [] #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ℹ more rows iris_cnt |> dplyr::collect() #> # A tibble: 150 × 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # ℹ 140 more rows iris_cnt |> dplyr::group_by(Species) |> dplyr::summarise( n = dplyr::n(), mean.Sepal.Length = mean(Sepal.Length, na.rm = TRUE) ) |> dplyr::collect() #> # A tibble: 3 × 3 #> Species n mean.Sepal.Length #> #> 1 setosa 50 5.01 #> 2 versicolor 50 5.94 #> 3 virginica 50 6.59"},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Upload content to the connector — upload_cnt","title":"Upload content to the connector — upload_cnt","text":"Generic implementing upload files connector: connector_fs: Uses file.copy() copy file file storage.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Upload content to the connector — upload_cnt","text":"","code":"upload_cnt(connector_object, file, name = basename(file), ...) # S3 method for class 'connector_fs' upload_cnt(connector_object, file, name = basename(file), ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Upload content to the connector — upload_cnt","text":"connector_object connector connector object use. file character Path file download upload name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Upload content to the connector — upload_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/upload_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Upload content to the connector — upload_cnt","text":"","code":"# Upload file to a file storage writeLines(\"this is an example\", \"example.txt\") cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt(pattern = \"example.txt\") #> character(0) cnt |> upload_cnt(\"example.txt\") cnt |> list_content_cnt(pattern = \"example.txt\") #> [1] \"example.txt\" cnt |> remove_cnt(\"example.txt\") file.remove(\"example.txt\") #> [1] TRUE"},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":null,"dir":"Reference","previous_headings":"","what":"Write content to the connector — write_cnt","title":"Write content to the connector — write_cnt","text":"Generic implementing write content different connector objects: connector_dbi: Uses DBI::dbWriteTable() write table DBI connection. connector_fs: Uses write_file() Write file based file extension. underlying function used, thereby also arguments available ... depends file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write content to the connector — write_cnt","text":"","code":"write_cnt(connector_object, x, name, ...) # S3 method for class 'connector_dbi' write_cnt(connector_object, x, name, ...) # S3 method for class 'connector_fs' write_cnt(connector_object, x, name, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write content to the connector — write_cnt","text":"connector_object connector connector object use. x object write connection name character Name content read, write, remove. Typically table name. ... Additional arguments passed method individual connector.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write content to the connector — write_cnt","text":"invisible connector_object.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_cnt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write content to the connector — write_cnt","text":"","code":"# Write table to DBI database cnt <- connector_dbi$new(RSQLite::SQLite()) cnt |> list_content_cnt() #> character(0) cnt |> write_cnt(iris, \"iris\") cnt |> list_content_cnt() #> [1] \"iris\" # Write different file types to a file storage cnt <- connector_fs$new(tempdir()) cnt |> list_content_cnt(pattern = \"iris\") #> [1] \"iris.csv\" \"iris.rds\" \"iris18322950d6e9.csv\" # rds file cnt |> write_cnt(iris, \"iris.rds\") # CSV file cnt |> write_cnt(iris, \"iris.csv\") cnt |> list_content_cnt(pattern = \"iris\") #> [1] \"iris.csv\" \"iris.rds\" \"iris18322950d6e9.csv\""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":null,"dir":"Reference","previous_headings":"","what":"Write files based on the extension — write_file","title":"Write files based on the extension — write_file","text":"write_file() backbone write_cnt() methods, files written connector. function wrapper around write_ext() appropriate function write file chosen depending file extension. write_ext() methods defined following file extensions: txt: readr::write_lines() csv: readr::write_csv() parquet: arrow::write_parquet() rds: readr::write_rds() sas7bdat: haven::write_sas() yml/yaml: yaml::write_yaml()","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write files based on the extension — write_file","text":"","code":"write_file(x, file, ...) write_ext(file, x, ...) # S3 method for class 'txt' write_ext(file, x, ...) # S3 method for class 'csv' write_ext(file, x, ...) # S3 method for class 'parquet' write_ext(file, x, ...) # S3 method for class 'rds' write_ext(file, x, ...) # S3 method for class 'xpt' write_ext(file, x, ...) # S3 method for class 'yml' write_ext(file, x, ...)"},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write files based on the extension — write_file","text":"x Object write file character() Path write file ... parameters passed functions behind methods file extension.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write files based on the extension — write_file","text":"write_file(): invisible() file. write_ext(): return functions behind individual methods.","code":""},{"path":"https://novonordisk-opensource.github.io/connector/reference/write_file.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Write files based on the extension — write_file","text":"","code":"# Write CSV file temp_csv <- tempfile(\"iris\", fileext = \".csv\") write_file(iris, temp_csv)"},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"migration-0-0-4","dir":"Changelog","previous_headings":"","what":"Migration:","title":"connector 0.0.4 (2024-12-03)","text":"Migration public github","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"features-0-0-4","dir":"Changelog","previous_headings":"","what":"Features:","title":"connector 0.0.4 (2024-12-03)","text":"Update create_directory_cnt() Added metadata parameter connect() comprehensive testing Better integration whirl connector.logger","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"other-0-0-4","dir":"Changelog","previous_headings":"","what":"Other:","title":"connector 0.0.4 (2024-12-03)","text":"Reducing number dependencies. Better messages","code":""},{"path":[]},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"breaking-changes-0-0-3","dir":"Changelog","previous_headings":"","what":"Breaking Changes:","title":"connector 0.0.3 (2024-09-25)","text":"rename function *_cnt cnt_","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"features-0-0-3","dir":"Changelog","previous_headings":"","what":"Features:","title":"connector 0.0.3 (2024-09-25)","text":"Nested connectors objects Use active bindings User guide added","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"connector-002","dir":"Changelog","previous_headings":"","what":"connector 0.0.2","title":"connector 0.0.2","text":"Added connectors super class","code":""},{"path":"https://novonordisk-opensource.github.io/connector/news/index.html","id":"connector-001","dir":"Changelog","previous_headings":"","what":"connector 0.0.1","title":"connector 0.0.1","text":"Initial version","code":""}]