<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tessercat.net/index.php?action=history&amp;feed=atom&amp;title=CKAN_Tricks</id>
	<title>CKAN Tricks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tessercat.net/index.php?action=history&amp;feed=atom&amp;title=CKAN_Tricks"/>
	<link rel="alternate" type="text/html" href="https://wiki.tessercat.net/index.php?title=CKAN_Tricks&amp;action=history"/>
	<updated>2026-04-08T02:54:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.2</generator>
	<entry>
		<id>https://wiki.tessercat.net/index.php?title=CKAN_Tricks&amp;diff=14390&amp;oldid=prev</id>
		<title>DRW: Add &quot;CKAN&quot; as an additional category for this page</title>
		<link rel="alternate" type="text/html" href="https://wiki.tessercat.net/index.php?title=CKAN_Tricks&amp;diff=14390&amp;oldid=prev"/>
		<updated>2023-11-21T18:22:26Z</updated>

		<summary type="html">&lt;p&gt;Add &amp;quot;CKAN&amp;quot; as an additional category for this page&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:22, 21 November 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l20&quot;&gt;Line 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 20:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To avoid keeping local databases about datasets, store such information (such as the last time an ETL job was run on a given package) in the 'extras' metadata field of the CKAN package, as much as possible. This stores information in a centralized location so ETL jobs can be run from multiple computers without any other coordination. The extras metadata fields are currently cataloged on the [[CKAN_Metadata]] page.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To avoid keeping local databases about datasets, store such information (such as the last time an ETL job was run on a given package) in the 'extras' metadata field of the CKAN package, as much as possible. This stores information in a centralized location so ETL jobs can be run from multiple computers without any other coordination. The extras metadata fields are currently cataloged on the [[CKAN_Metadata]] page.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Onboarding]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Onboarding&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] [[Category:CKAN&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wprdc_wiki-mediawiki-:diff::1.12:old-14270:rev-14390 --&gt;
&lt;/table&gt;</summary>
		<author><name>DRW</name></author>
	</entry>
	<entry>
		<id>https://wiki.tessercat.net/index.php?title=CKAN_Tricks&amp;diff=14270&amp;oldid=prev</id>
		<title>DRW: Add CKAN Tricks page</title>
		<link rel="alternate" type="text/html" href="https://wiki.tessercat.net/index.php?title=CKAN_Tricks&amp;diff=14270&amp;oldid=prev"/>
		<updated>2022-04-28T17:06:59Z</updated>

		<summary type="html">&lt;p&gt;Add CKAN Tricks page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Manage datasets ==&lt;br /&gt;
=== Undelete deleted datasets ===&lt;br /&gt;
If you know the URL of the deleted dataset AND you are logged in as an administrator, you can go to that URL in your web browser and see the deleted dataset. &amp;quot;[Deleted]&amp;quot; will have been appended to the title of the dataset, and the value of the metadata field &amp;lt;code&amp;gt;state&amp;lt;/code&amp;gt; will be equal to &amp;quot;deleted&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To undelete such a dataset, just use the CKAN API or use the &lt;br /&gt;
[https://github.com/WPRDC/utility-belt/blob/master/gadgets.py#L767 set_package_parameters_to_values() function] to set the package's &amp;lt;code&amp;gt;state&amp;lt;/code&amp;gt; metadata value to &amp;quot;active&amp;quot;. For the latter option, invoke the function like this:&lt;br /&gt;
&amp;lt;code&amp;gt;set_package_parameters_to_values(&amp;quot;https://data.wprdc.org&amp;quot;, deleted_package_id, ['state'], ['active'], API_key)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Queries ==&lt;br /&gt;
=== Make queries faster ===&lt;br /&gt;
[https://ckan.org/2017/08/10/faster-datastore-in-ckan-2-7/ Speed up datastore_search queries] by including the &amp;lt;code&amp;gt;include_total=False&amp;lt;/code&amp;gt; parameter to skip calculation of the total number of rows (which can reduce response time by a factor of 2).  The [https://docs.ckan.org/en/ckan-2.7.3/maintaining/datastore.html#ckanext.datastore.logic.action.datastore_search datastore_search API call] lets you search a given datastore by column values and return subsets of the records. There's more on benchmarking CKAN performance [http://urbanopus.net/benchmarking-the-ckan-datastore-api/ here].&lt;br /&gt;
&lt;br /&gt;
Another way to speed up datastore search queries is to index fields used in the filtering. Note that (at least when the primary key is a combination of fields), if you don't list each primary key field as a separate field to index, those fields don't get indexed and queries take way longer.&lt;br /&gt;
&lt;br /&gt;
=== Avoiding stale query caches ===&lt;br /&gt;
Queries/API responses can be cached based upon nginx settings. If you find that your SQL query is getting a stale response, try changing your query slightly. For instance, instead of `SELECT MAX(some_field) AS biggest FROM &amp;lt;resource-id&amp;gt;`, you could change the assigned variable name (`SELECT MAX(some_field) AS biggest0413 FROM &amp;lt;resource-id&amp;gt;`) or add another field that you ignore (`SELECT MAX(some_field) AS biggest, MAX(some_field) AS whatever FROM &amp;lt;resource-id&amp;gt;`).&lt;br /&gt;
&lt;br /&gt;
== Scripts that interact with CKAN through the API ==&lt;br /&gt;
=== Run those CKAN-monitoring/modifying scripts from multiple servers by centralizing data ===&lt;br /&gt;
To avoid keeping local databases about datasets, store such information (such as the last time an ETL job was run on a given package) in the 'extras' metadata field of the CKAN package, as much as possible. This stores information in a centralized location so ETL jobs can be run from multiple computers without any other coordination. The extras metadata fields are currently cataloged on the [[CKAN_Metadata]] page.&lt;br /&gt;
&lt;br /&gt;
[[Category:Onboarding]]&lt;/div&gt;</summary>
		<author><name>DRW</name></author>
	</entry>
</feed>