ficonsulting / RInno

How to install local shiny apps
https://ficonsulting.github.io/RInno/
Other
307 stars 67 forks source link

How to build a Database in the App #78

Closed vikram-rawat closed 6 years ago

vikram-rawat commented 6 years ago

I am trying to build an app which should store data into a postgresql database. How can I make sure the person who installs the app has an Postgresql dB installed if not get it installed and then I could build a database and a new table only once but not everytime he runs it.

I mean Just please guide me If There is a workaround that I am not aware of. Or is it possible that will recreate the same environment on the other PC along with same db configurations that I have. Please do reply.

Dripdrop12 commented 6 years ago

Have you tried using RSQLite? That is probably the easiest way to port a small, light-weight database with your app, whereas postgresql is designed to serve as a central, shared database. We could support it, but I feel like SQLite is the best option for this use case.

I would initialize the SQLite database if it doesn't already exist in your global.R file. Then you should be able to use it within your app. Does that make sense?

vikram-rawat commented 6 years ago

I am now trying the entire app in rsqlite but I am not able to disconnect the connection for some reasons.

But then again it would be much more secure if I could port a good database like postgresql with it.

You should please think about finding a way to get a database running into RInno... It would make the environment more complete.

It's definitely one of the things a full fledged framework will need for sure. I know its just a simple prototype but in future please think about it.

And yes since you are good with shiny... If you could help me with

https://community.rstudio.com/t/best-way-to-dbdisconnect-in-shiny/7499

Please do visit the link

And thanks for replying and keep up the work

गुरु, 19 अप्रैल 2018, 7:14 pm को Jonathan Hill notifications@github.com ने लिखा:

[image: Boxbe] https://www.boxbe.com/overview This message is eligible for Automatic Cleanup! (notifications@github.com) Add cleanup rule https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3D994TZyZqDLRbyGGrzE4DjTM7lIZ%252BS3h0rrZr41XPsQQ%253D%26token%3Dga0nCGccQserrQ3ILJiB85PM4Q1mMP%252BFPqchVCenwIwtYHfBqrDuXzJPf52y9XmkMCE1E0r6E29xp8nughZj9no2kSptvrq0%252BDugRWge1lsPt1F09nNpuGrEwBzG%252Fw84MZWiXPdIiDGziurSeFx%252BaA%253D%253D&tc_serial=38507525356&tc_rand=1339540838&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001 | More info http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=38507525356&tc_rand=1339540838&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001

Have you tried using RSQLite https://cran.r-project.org/web/packages/RSQLite/vignettes/RSQLite.html? That is probably the easiest way to port a small, light-weight database with your app, whereas postgresql is designed to serve as a central, shared database. We could support it, but I feel like SQLite is the best option for this use case.

I would initialize the SQLite database if it doesn't already exist in your global.R file. Then you should be able to use it within your app. Does that make sense?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ficonsulting/RInno/issues/78#issuecomment-382733947, or mute the thread https://github.com/notifications/unsubscribe-auth/AVTrxHxyS5XfEy_ECXvXaVhi4XMyc8Yqks5tqJAzgaJpZM4TbSE- .

vikram-rawat commented 6 years ago

Thanks for your reply.

I built the app with sqlite But I would suggest to keep the question open and let us allow a database in the app. something like sql_server or postgres or mongo etc...

It's a must have step for any app. and if it could open seperately apart from chrome then it would have an app like feel too.. but database is an integrated part of the app that just can't be ignored.

Dripdrop12 commented 6 years ago

No problem Vikram.

Those three databases are designed to run on a server. Although they can be configured to run locally, they really should be deployed on a central server which each app connects to. SQLite is uniquely designed to provide a distributed 1-to-1 app-to-database setup. I'd be happy to debate the merits of the other databases from a security and performance standpoint, but I really think they may be out of scope for local deployments of Shiny apps.

vikram-rawat commented 6 years ago

Thanks for taking time to reply.

I totally get your point and what you are saying. I have no intention of debating with you. I just thought that it would be a nice idea as those databases have more functionality and are better in many cases. And We could also use them just for a single computer app too. Because data would be more secure and more functional that ways.

But I totally get it this is not a priority right now and I understand that. However, you should definitely think in this respect too...

And yes I love this project. Way to go ...