{"id":14067135,"url":"https://github.com/HuangRicky/DBFactory","last_synced_at":"2025-07-30T00:32:29.351Z","repository":{"id":165324042,"uuid":"272594107","full_name":"HuangRicky/DBFactory","owner":"HuangRicky","description":"R package to manage database connections","archived":false,"fork":false,"pushed_at":"2020-06-16T03:14:31.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-13T07:12:56.026Z","etag":null,"topics":["connection","connection-pool","database","mysql","odbc","oracle","r","sqlserver"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HuangRicky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-16T02:47:44.000Z","updated_at":"2021-11-29T21:45:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"362a5e9b-eb63-4842-8ae5-a2990655b60a","html_url":"https://github.com/HuangRicky/DBFactory","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuangRicky%2FDBFactory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuangRicky%2FDBFactory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuangRicky%2FDBFactory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HuangRicky%2FDBFactory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HuangRicky","download_url":"https://codeload.github.com/HuangRicky/DBFactory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228065209,"owners_count":17863963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connection","connection-pool","database","mysql","odbc","oracle","r","sqlserver"],"created_at":"2024-08-13T07:05:26.968Z","updated_at":"2024-12-04T07:30:43.224Z","avatar_url":"https://github.com/HuangRicky.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# DBFactory\nR package to manage database connections\n\n# Installation\nTo install this package, you can download or clone the file, R CMD INSTALL or use RStudio to open and install, or use devtools:\n   \n```\ndevtools::install_github(\"HuangRicky/DBFactory\")\n```\n\n# Setting Up DB Information\nYou can create a Database Definition data.frame first:\n```\n  sample_db_info \u003c- data.frame(name=c('DEV','PRD', 'XXX', 'LOCAL','LOCALMYSQL','LOCALEXPRESS','SB'),\n                               type=c(\"sqlserver\", 'oracle',\"sqlserver\",'sqlserver', 'mysql','sqlserver',\n                                      'sybaseiq'),\n                               connstring=c('', NA,NA,NA,NA,NA,NA),\n                               server=c(\"serveraddress1\", 'serveraddress2',\n                                        'tcp:xxxxx.database.windows.net,1433','localhost,1433',\n                                        'localhost','localhost,14433',\n                                        'testserver;port=9903'),\n                               initdb=c(\"A\",NA,'XXX','XXX','TEACHING','TEACHING','SYBASEID'),\n                               istrusted=c(T,F,F,F,F,F,F),\n                               user=c(\"\",'a1','XXX','xxx','user_1','user_1','user_2'),\n                               pass=c(\"\",NA,'','','','',''), stringsAsFactors = F)\n```\n\nIf you download source code and install, you can run the following to write to your source package.\n```\n  jsonlite::write_json(sample_db_info, 'inst/extdata/dbdata.json', pretty=T, na='null')\n```\n\nIf you install the package already, you can directly change the json file in your Library location:\n```\n  nowlibpath \u003c- paste0(.Library,'/DBFactory/extdata/dbdata.json')\n  jsonlite::write_json(sample_db_info, nowlibpath, pretty=T, na='null')\n```\n\n# Usage\n```\nlibrary(DBFactory)\n# to set default object:\nset_default_dbobj(\"LOCALMYSQL\")\nset_default_dbobj(\"LOCALEXPRESS\")\n\n# see MySQL:\nDBFactory::set_default_dbobj(\"LOCALMYSQL\")\nrun_query('select * from teaching.Table1')\n\n# see MSSQL:\nDBFactory::set_default_dbobj(\"LOCALEXPRESS\")\nrun_query('select * from TEACHING.dbo.Test1')\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHuangRicky%2FDBFactory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHuangRicky%2FDBFactory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHuangRicky%2FDBFactory/lists"}