Recently the scriptDb service was deprecated from google apps script, and will be shut off completely in the coming months. I have a project which utilizes this service and I wish to phase out the use of scriptDb before it's too late. Currently, my project uses the scriptDb service in the following way:
最近,scriptDb服务已从谷歌应用程序脚本中弃用,并将在未来几个月内完全关闭。我有一个利用这项服务的项目,我希望在为时已晚之前逐步停止使用scriptDb。目前,我的项目以下列方式使用scriptDb服务:
My script project would take in a series of XML files and parse these to generate javascript objects who's parameters were specific entries in the XML's. For example an object could be:
我的脚本项目将接受一系列XML文件并解析这些文件以生成javascript对象,其参数是XML中的特定条目。例如,对象可以是:
{type: "proposal", pi: "John Doe", coIs: {"bob", "sue"}}
etc. Each parameter of the object was filled in based on the data in an XML file. I would then proceed to store these objects in the script databse using the db.save(object) command. This was very useful for me because I could query and have returned to me arrays of objects based on specific parameters I may be looking for -outside of the execution where the objects are actually instantiated from the XML's.
基于XML文件中的数据填充对象的每个参数。然后,我将使用db.save(object)命令将这些对象存储在脚本数据库中。这对我来说非常有用,因为我可以根据我可能正在寻找的特定参数查询并返回给我的对象数组 - 执行的实际位置,其中对象实际上是从XML实例化的。
The google script migration from scriptDb guide has several suggestions however I feel it would be overly complicated (I wouldn't really know where to begin) to implement an SQL type data structure as these are simple and relatively small objects and I am dealing with a low volume of these objects (in the dozens).
从scriptDb指南中进行google脚本迁移有几个建议,但我觉得实现SQL类型数据结构会过于复杂(我真的不知道从哪里开始),因为这些是简单且相对较小的对象,我正在处理这些物体的体积很小(数十个)。
Is there an effective and simple way for me to store these objects after they are generated, so that I can use them in later executions? (not using the scriptDb obviously).
有没有一种有效而简单的方法让我在生成这些对象后存储它们,以便我可以在以后的执行中使用它们? (显然不使用scriptDb)。
Thanks for any input.
感谢您的任何意见。
2 个解决方案
#1
1
Since its only a few dozen objects, do not use mongo or any other external db. First see exactly how you are querying. Then, decide to store in spreadsheet (a single cell can have a million chars) or properties service. If your queries are limited to certain combinations you might be able to write separate properties and get them directly. Else just store all your db in a single object like a js map. Stringify it and store in a spreadsheet. Mirror the data on a cache so you only read the ss if the cache isnt there (cache can be set to expire in up to 6hours). Finally, filter it in-memory. This will be hundreds of times faster than any external db.
由于它只有几十个对象,所以不要使用mongo或任何其他外部数据库。首先看看你究竟是如何查询的。然后,决定存储在电子表格中(单个单元格可以有一百万个字符)或属性服务。如果您的查询仅限于某些组合,您可以编写单独的属性并直接获取它们。否则只需将所有数据库存储在单个对象中,如js map。将其字符串化并存储在电子表格中。镜像缓存中的数据,以便只有缓存不存在才能读取ss(缓存可以设置为最多6小时到期)。最后,将其过滤到内存中。这将比任何外部数据库快数百倍。
#2
0
I don’t know about any google internal services, but if it can be anywhere on the web you could use mongoHQ or something similar and store the documents in a mongodb.
我不知道任何谷歌内部服务,但如果它可以在网络上的任何地方你可以使用mongoHQ或类似的东西,并将文件存储在mongodb中。
Sounds like this should do exactly what you need and it would be for free for you (up to 500MB of data). The big disadvantage is the high latency, since the free version is really slow, and you need to talk to it across the internet (don’t know in which datacenter their free-databases are stored).
这样的听起来应该完全符合您的需求,而且对您来说是免费的(最多500MB的数据)。最大的缺点是高延迟,因为免费版本非常慢,你需要通过互联网与它交谈(不知道他们的免费数据库存储在哪个数据中心)。
Update:
更新:
There is already another post on SO, how to move from ScriptDB to MongoDB (How to replace the deprecated ScriptDb with Mongodb using URL Fetch service?)
SO上已有另一篇文章,如何从ScriptDB迁移到MongoDB(如何使用URL Fetch服务将不推荐使用的ScriptDb替换为Mongodb?)
#1
1
Since its only a few dozen objects, do not use mongo or any other external db. First see exactly how you are querying. Then, decide to store in spreadsheet (a single cell can have a million chars) or properties service. If your queries are limited to certain combinations you might be able to write separate properties and get them directly. Else just store all your db in a single object like a js map. Stringify it and store in a spreadsheet. Mirror the data on a cache so you only read the ss if the cache isnt there (cache can be set to expire in up to 6hours). Finally, filter it in-memory. This will be hundreds of times faster than any external db.
由于它只有几十个对象,所以不要使用mongo或任何其他外部数据库。首先看看你究竟是如何查询的。然后,决定存储在电子表格中(单个单元格可以有一百万个字符)或属性服务。如果您的查询仅限于某些组合,您可以编写单独的属性并直接获取它们。否则只需将所有数据库存储在单个对象中,如js map。将其字符串化并存储在电子表格中。镜像缓存中的数据,以便只有缓存不存在才能读取ss(缓存可以设置为最多6小时到期)。最后,将其过滤到内存中。这将比任何外部数据库快数百倍。
#2
0
I don’t know about any google internal services, but if it can be anywhere on the web you could use mongoHQ or something similar and store the documents in a mongodb.
我不知道任何谷歌内部服务,但如果它可以在网络上的任何地方你可以使用mongoHQ或类似的东西,并将文件存储在mongodb中。
Sounds like this should do exactly what you need and it would be for free for you (up to 500MB of data). The big disadvantage is the high latency, since the free version is really slow, and you need to talk to it across the internet (don’t know in which datacenter their free-databases are stored).
这样的听起来应该完全符合您的需求,而且对您来说是免费的(最多500MB的数据)。最大的缺点是高延迟,因为免费版本非常慢,你需要通过互联网与它交谈(不知道他们的免费数据库存储在哪个数据中心)。
Update:
更新:
There is already another post on SO, how to move from ScriptDB to MongoDB (How to replace the deprecated ScriptDb with Mongodb using URL Fetch service?)
SO上已有另一篇文章,如何从ScriptDB迁移到MongoDB(如何使用URL Fetch服务将不推荐使用的ScriptDb替换为Mongodb?)