问题描述
我有一个CKAN数据存储,其中有一列名为 recvTime的时间戳类型(即在datastore_create时使用 timestamp作为类型,)。该列的示例值为 2014-06-12T16:08:39.542000。
I have a CKAN datastore with a column named "recvTime" of type timestamp (i.e. using "timestamp" as type at datastore_create time, as shown in this link). Example value for this column is "2014-06-12T16:08:39.542000".
我在数据存储区中有大量记录(数千个),我想删除 recvTime中给定日期之前的行。我的第一个想法是使用REST API并通过使用范围过滤器的datastore_delete操作来完成此操作,但是无法按照。
I have a large numbers of records in the datastore (thousands) and I would like to delete the rows before a given date in "recvTime". My first thought was doing it using the REST API with the datastore_delete operation using a range filter, but it is not possible as described in the following Q&A.
请问还有其他解决方法吗?
Is there any other way of solving the issue, please?
鉴于我可以访问运行CKAN服务器的主机,我想知道是否可以在持久化数据存储的Postgresql引擎上执行常规SQL语句来实现这一点。但是,我还没有在CKAN文档中找到有关操纵CKAN底层数据模型的信息,所以不知道这是一个好主意还是有风险...
Given that I have access to the host where CKAN server is running, I wonder if this could be achieved executing a regular SQL sentence on the Postgresql engine where the datastore is persisted. However, I haven't found information about manipulating the CKAN underlying datamodel in the CKAN documentation, so don't know if this a good idea or if it is risky...
任何解决方法或信息指针都非常受欢迎。谢谢!
Any workaround or information pointer is highly welcome. Thanks!
推荐答案
如果您愿意在底层数据库中进行挖掘,那么绝对可以直接在底层数据库上执行此操作(结构很漂亮简单,以对应的资源ID命名的表)。您甚至可以使用扩展名将其转换为自己的API(尽管您要注意权限)。
You could definitely do this directly on the underlying database if you were willing to dig in there (the structure is pretty simple with tables named after the corresponding resource id). You could even turn this into an API of your own using an extension (though you'd want to be careful about permissions).
您可能还对新版本感兴趣支持(仅适用于atm主机)通过扩展中的插件扩展DataStore API-请参见
You might also be interested in the new support (master only atm) for extending the DataStore API via a plugin in an extension - see https://github.com/ckan/ckan/pull/1725
这篇关于按时间范围删除数据存储区中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!