简体   繁体   English

Ruby on Rails - 数据库或excel

[英]Ruby on Rails - Database or excel

I am currently doing a project in Ruby on Rails and I have been presented with a dilemma. 我目前正在使用Ruby on Rails进行一个项目,我遇到了一个两难的问题。

The dilemma is that the users of my system will be uploading an excel spreadsheet. 困境是我系统的用户将上传excel电子表格。 The issue is should I just read straight from this excel spreadsheet into my front-end or should I load this spreadsheet into my MySQL database and then to my front-end. 问题是我应该直接从这个excel电子表格读到我的前端,还是应该将这个电子表格加载到我的MySQL数据库中,然后加载到我的前端。

I have asked numerous people about this issue and have researched on-line to no avail. 我已经向很多人询问过这个问题并且已经在线研究无济于事。

Any help would be much appreciated. 任何帮助将非常感激。

The Excel file is not a database. Excel文件不是数据库。 If you need to allow it as source input, parse it, copy the data into a real database and connect to it. 如果您需要将其作为源输入,请解析它,将数据复制到真实数据库并连接到它。

The database is more flexible and efficient for querying and processing information. 数据库更灵活,更有效地查询和处理信息。

I can think of two benefits, or rather options, of having them upload the excel spreadsheet for processing by your back end. 我可以想到让他们上传excel电子表格以供后端处理的两个好处,或者更确切地说是选项。

1) would be for your tracking purposes (who sent what and here is what the back-end did with it...). 1)将用于您的跟踪目的(谁发送了什么,这是后端用它做的......)。 In fact consider that other formats/versions could be introduced, would it be important to keep them to identify what went wrong? 事实上,考虑到可以引入其他格式/版本,是否重要的​​是让他们确定哪里出了问题? "How can we handle this new format"? “我们如何处理这种新格式”?

2) On the other side, the front-end way that is, you offload processing from the back-end, but that means that the browser app could get fairly complex and depending on your excel, that is if it has many relationships, sending that data up to the server could be complex. 2)另一方面,前端方式,即你从后端卸载处理,但这意味着浏览器应用程序可能变得相当复杂并且取决于你的excel,即如果它有很多关系,发送到服务器的数据可能很复杂。 However if is simply a flat spreadsheet, say simple rows without totals/tax calc/..., then it might be an advantage of loading it into the browser and then sending these rows up to the server if offloading processing is of any importance. 但是,如果只是一个扁平的电子表格,比如没有总计/税计算/ ...的简单行,那么将它加载到浏览器中然后将这些行发送到服务器可能是一个优势,如果卸载处理是重要的。

However point 2 really is diluted by point 1, which to me would be of greater importance for future migration of this service. 然而,第2点确实被第1点稀释,对我而言,这对于此服务的未来迁移将更为重要。 So I personally would choose uploading it and processing on the back end. 所以我个人会选择在后端上传和处理。

Update 更新

As you clarified in the comments, if you are asking about the use of Excel on the backend as a database? 正如您在评论中澄清的那样,如果您询问在后端使用Excel作为数据库? I would agree with Simone Carletti's answer here. 我同意Simone Carletti在这里的回答。 Maybe just add a real database gives you much more flexibility, more tools and, more performance. 也许只需添加一个真正的数据库,您就可以获得更多灵活性,更多工具和更高性能。 This difference is loading a file, parsing it into some structure, then saving it (unless you are using some .NET framework and even if, the Database (MySQL, MongoDB...) would give you much more flexibility in structuring and querying, over the headache of managing with the speed of DB connections. You might just want to write a sample in both to evaluate, the DB solution will probably win you over. 这种差异是加载文件,将其解析为某种结构,然后保存它(除非您使用的是某些.NET框架,即使数据库(MySQL,MongoDB ...)在结构化和查询方面给您更多的灵活性,管理数据库连接的速度令人头疼。您可能只想在两者中编写样本进行评估,数据库解决方案可能会赢得您的支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM