Update notes for 2018-09-24

This commit is contained in:
Alan Orth 2018-09-25 02:24:43 +03:00
parent 9993ecc196
commit 27c3f48ef6
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
3 changed files with 60 additions and 8 deletions

View File

@ -434,5 +434,30 @@ sqlite> INSERT INTO items(id, views) VALUES(0, 7) ON CONFLICT(id) DO UPDATE SET
- But when I deployed it on my Ubuntu 16.04 environment I realized Ubuntu's SQLite is old and doesn't support `UPSERT`, so my indexing doesn't work...
- Apparently `UPSERT` came in SQLite 3.24.0 (2018-06-04), and Ubuntu 16.04 has 3.11.0
- Ok this is hilarious, I manually downloaded the [libsqlite3 3.24.0 deb from Ubuntu 18.10 "cosmic"](https://packages.ubuntu.com/cosmic/libsqlite3-0) and installed it in Ubnutu 16.04 and now the Python `indexer.py` works
- This is definitely a dirty hack, but the list of packages we use that depend on `libsqlite3-0` in Ubuntu 16.04 are actually pretty few:
```
# apt-cache rdepends --installed libsqlite3-0 | sort | uniq
gnupg2
libkrb5-26-heimdal
libnss3
libpython2.7-stdlib
libpython3.5-stdlib
```
- I wonder if I could work around this by detecting the SQLite library version, for example on Ubuntu 16.04 after I replaced the library:
```
# python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> print(sqlite3.sqlite_version)
3.24.0
```
- Or maybe I should just bite the bullet and migrate this to PostgreSQL, as it [supports `UPSERT` since version 9.5](https://wiki.postgresql.org/wiki/UPSERT) and also seems to have my new favorite `LIMIT` and `OFFSET`
- I changed the syntax of the SQLite stuff and PostgreSQL is working flawlessly with psycopg2... hmmm.
<!-- vim: set sw=2 ts=2: -->

View File

@ -18,7 +18,7 @@ I&rsquo;m testing the new DSpace 5.8 branch in my Ubuntu 18.04 environment and I
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2018-09/" /><meta property="article:published_time" content="2018-09-02T09:55:54&#43;03:00"/>
<meta property="article:modified_time" content="2018-09-24T16:24:35&#43;03:00"/>
<meta property="article:modified_time" content="2018-09-24T16:35:43&#43;03:00"/>
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="September, 2018"/>
<meta name="twitter:description" content="2018-09-02
@ -41,9 +41,9 @@ I&rsquo;m testing the new DSpace 5.8 branch in my Ubuntu 18.04 environment and I
"@type": "BlogPosting",
"headline": "September, 2018",
"url": "https://alanorth.github.io/cgspace-notes/2018-09/",
"wordCount": "3180",
"wordCount": "3318",
"datePublished": "2018-09-02T09:55:54&#43;03:00",
"dateModified": "2018-09-24T16:24:35&#43;03:00",
"dateModified": "2018-09-24T16:35:43&#43;03:00",
"author": {
"@type": "Person",
"name": "Alan Orth"
@ -612,6 +612,33 @@ sqlite&gt; INSERT INTO items(id, views) VALUES(0, 7) ON CONFLICT(id) DO UPDATE S
<li>But when I deployed it on my Ubuntu 16.04 environment I realized Ubuntu&rsquo;s SQLite is old and doesn&rsquo;t support <code>UPSERT</code>, so my indexing doesn&rsquo;t work&hellip;</li>
<li>Apparently <code>UPSERT</code> came in SQLite 3.24.0 (2018-06-04), and Ubuntu 16.04 has 3.11.0</li>
<li>Ok this is hilarious, I manually downloaded the <a href="https://packages.ubuntu.com/cosmic/libsqlite3-0">libsqlite3 3.24.0 deb from Ubuntu 18.10 &ldquo;cosmic&rdquo;</a> and installed it in Ubnutu 16.04 and now the Python <code>indexer.py</code> works</li>
<li>This is definitely a dirty hack, but the list of packages we use that depend on <code>libsqlite3-0</code> in Ubuntu 16.04 are actually pretty few:</li>
</ul>
<pre><code># apt-cache rdepends --installed libsqlite3-0 | sort | uniq
gnupg2
libkrb5-26-heimdal
libnss3
libpython2.7-stdlib
libpython3.5-stdlib
</code></pre>
<ul>
<li>I wonder if I could work around this by detecting the SQLite library version, for example on Ubuntu 16.04 after I replaced the library:</li>
</ul>
<pre><code># python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import sqlite3
&gt;&gt;&gt; print(sqlite3.sqlite_version)
3.24.0
</code></pre>
<ul>
<li>Or maybe I should just bite the bullet and migrate this to PostgreSQL, as it <a href="https://wiki.postgresql.org/wiki/UPSERT">supports <code>UPSERT</code> since version 9.5</a> and also seems to have my new favorite <code>LIMIT</code> and <code>OFFSET</code></li>
<li>I changed the syntax of the SQLite stuff and PostgreSQL is working flawlessly with psycopg2&hellip; hmmm.</li>
</ul>
<!-- vim: set sw=2 ts=2: -->

View File

@ -4,7 +4,7 @@
<url>
<loc>https://alanorth.github.io/cgspace-notes/2018-09/</loc>
<lastmod>2018-09-24T16:24:35+03:00</lastmod>
<lastmod>2018-09-24T16:35:43+03:00</lastmod>
</url>
<url>
@ -184,7 +184,7 @@
<url>
<loc>https://alanorth.github.io/cgspace-notes/</loc>
<lastmod>2018-09-24T16:24:35+03:00</lastmod>
<lastmod>2018-09-24T16:35:43+03:00</lastmod>
<priority>0</priority>
</url>
@ -195,7 +195,7 @@
<url>
<loc>https://alanorth.github.io/cgspace-notes/tags/notes/</loc>
<lastmod>2018-09-24T16:24:35+03:00</lastmod>
<lastmod>2018-09-24T16:35:43+03:00</lastmod>
<priority>0</priority>
</url>
@ -207,13 +207,13 @@
<url>
<loc>https://alanorth.github.io/cgspace-notes/posts/</loc>
<lastmod>2018-09-24T16:24:35+03:00</lastmod>
<lastmod>2018-09-24T16:35:43+03:00</lastmod>
<priority>0</priority>
</url>
<url>
<loc>https://alanorth.github.io/cgspace-notes/tags/</loc>
<lastmod>2018-09-24T16:24:35+03:00</lastmod>
<lastmod>2018-09-24T16:35:43+03:00</lastmod>
<priority>0</priority>
</url>