Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails with CSV (No DB)

Tags:

csv

grails

groovy

I have been building a grails application for quite a while with dummy data using MySQL server, this was eventually supposed to be connected to Greenplum DB (postgresql cluster). But this is not feasible anymore due to firewall issues.

We were contemplating connecting grails to a CSV file on a shared drive( which is constantly updated by greenplum DB, data is appended hourly only) These CSV files are fairly large(3mb, 30mb and 60mb) The last file has 550,000+ rows. Quick questions:

  1. Is this even feasible? Can CSV be treated as a database and can grails directly access this CSV file and run queries on it, similar to that of a DB?
  2. Assuming this is feasible, how much rework will be required in the grails codes in Datasource, controller and index ( Currently, we are connected to Mysql and we filter data in controller and index using sql queries and ajax calls using remotefunction)
  3. Will the constant reading( csv -> grails ) and writing (greenplum -> csv) render the csv file corrupt or bring up any more problems?

I know this is not a very robust method, but I really need to understand the feasibility of this idea. Can grails function wihtout any DB and merely a CSV file on a shared drive accesssible to multiple users?

like image 936
user3825692 Avatar asked Dec 05 '25 04:12

user3825692


1 Answers

The short answer is, No. This won't be a good solution.

  1. No.
  2. It would be nearly impossible, if at all possible to rework this.
  3. Concurrent access to a file like that in any environment is a recipe for disaster.

Grails is not suitable for a solution like this.

update: Have you considered using the built in H2 database which can be packaged with the Grails application itself? This way you can distribute the database engine along with your Grails application within the WAR. You could even have it populate it's database from the CSV you mention the first time it runs, or periodically. Depending on your requirements.

like image 157
Joshua Moore Avatar answered Dec 10 '25 09:12

Joshua Moore