WIP: bees service
[jackhill/guix/guix.git] / gnu / packages / databases.scm
index 7bce37c..2353e3b 100644 (file)
 ;;; Copyright © 2017 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2017 Adriano Peluso <catonano@gmail.com>
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
-;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2017, 2018 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017, 2018 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2017, 2018 Pierre Langlois <pierre.langlois@gmx.com>
-;;; Copyright © 2015, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2017, 2018, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Kristofer Buffington <kristoferbuffington@gmail.com>
 ;;; Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net>
 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
-;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2018, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Jack Hill <jackhill@jackhill.us>
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
-;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2019, 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
 ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
 ;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
+;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
+;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
-  #:use-module (gnu packages guile)
-  #:use-module (gnu packages time)
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages guile)
+  #:use-module (gnu packages icu4c)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages language)
+  #:use-module (gnu packages libedit)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lisp)
+  #:use-module (gnu packages lisp-xyz)
   #:use-module (gnu packages logging)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages parallel)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-crypto)
-  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-science)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages rdf)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages terminals)
   #:use-module (gnu packages textutils)
+  #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages valgrind)
   #:use-module (gnu packages web)
   #:use-module (guix download)
   #:use-module (guix bzr-download)
   #:use-module (guix git-download)
+  #:use-module (guix hg-download)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
 either single machines or networked clusters.")
     (license license:gpl3+)))
 
-(define-public go-gopkg.in-mgo.v2
-  (package
-    (name "go-gopkg.in-mgo.v2")
-    (version "2016.08.01")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/go-mgo/mgo")
-                    (commit (string-append "r" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0rwbi1z63w43b0z9srm8m7iz1fdwx7bq7n2mz862d6liiaqa59jd"))))
-    (build-system go-build-system)
-    (arguments
-     `(#:import-path "gopkg.in/mgo.v2"
-       ;; TODO: The tests fail as MongoDB fails to start
-       ;; Error parsing command line: unrecognised option '--chunkSize'
-       #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'reset-gzip-timestamps)
-         (add-before 'check 'start-mongodb
-           (lambda* (#:key tests? #:allow-other-keys)
-             (when tests?
-               (with-directory-excursion "src/gopkg.in/mgo.v2"
-                 (invoke "make" "startdb")))
-             #t))
-         (add-after 'check 'stop'mongodb
-           (lambda* (#:key tests? #:allow-other-keys)
-             (when tests?
-               (with-directory-excursion "src/gopkg.in/mgo.v2"
-                 (invoke "make" "stopdb")))
-             #t)))))
-    (native-inputs
-     `(("go-gopkg.in-check.v1" ,go-gopkg.in-check.v1)
-       ("mongodb" ,mongodb)
-       ("daemontools" ,daemontools)))
-    (synopsis "@code{mgo} offers a rich MongoDB driver for Go.")
-    (description
-     "@code{mgo} (pronounced as mango) is a MongoDB driver for the Go language.
-It implements a rich selection of features under a simple API following
-standard Go idioms.")
-    (home-page "https://labix.org/mgo")
-    (license license:bsd-2)))
-
 (define-public ephemeralpg
   (package
     (name "ephemeralpg")
-    (version "3.0")
+    (version "3.1")
     (source
      (origin
        (method url-fetch)
@@ -240,10 +205,10 @@ standard Go idioms.")
              "https://eradman.com/ephemeralpg/code/ephemeralpg-"
              version ".tar.gz"))
        (sha256
-        (base32 "1j0g7g114ma7y7sadbng5p1ss1zsm9zpicm77qspym6565733vvh"))))
+        (base32 "1ap22ki8yz6agd0qybcjgs4b9izw1rwwcgpxn3jah2ccfyax34s6"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:make-flags (list "CC=gcc"
+     `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
                           (string-append "PREFIX=" %output))
        #:phases
        (modify-phases %standard-phases
@@ -306,6 +271,183 @@ ElasticSearch server")
     (home-page "https://github.com/patientslikeme/es_dump_restore")
     (license license:expat)))
 
+(define-public firebird
+  (package
+    (name "firebird")
+    (version "3.0.7")
+    (source
+     (let ((revision "33374-0"))
+       (origin
+         (method url-fetch)
+         (uri (string-append "https://github.com/FirebirdSQL/"
+                             "firebird/releases/download/R"
+                             (string-replace-substring version "." "_") "/"
+                             "Firebird-" version "." revision ".tar.bz2"))
+         (sha256
+          (base32 "0xpy1bncz36c6n28y7kllm1dkrdkn4vb4gw2n43f2351mznmrf5c"))
+         (modules '((guix build utils)))
+         (snippet
+          `(begin
+             (for-each
+              delete-file-recursively
+              (list "extern/btyacc/test" ; TODO: package and remove entirely
+                    "extern/editline"
+                    "extern/icu"
+                    "extern/libtommath"
+                    "extern/zlib"
+                    "src/include/firebird/impl/boost"
+
+                    ;; Missing licence.
+                    "builds/install/arch-specific/solaris"
+                    "extern/SfIO"
+                    "src/msgs/templates.sql"
+
+                    ;; Generated files missing sources.
+                    "doc/Firebird-3-QuickStart.pdf"
+                    (string-append "doc/Firebird-" ,version
+                                   "-ReleaseNotes.pdf")
+                    "doc/README.SecureRemotePassword.html"))
+             #t)))))
+    (build-system gnu-build-system)
+    (outputs (list "debug" "out"))
+    (arguments
+     `(#:configure-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list (string-append "--with-fbsbin=" out "/sbin")
+               (string-append "--with-fbdoc=" out "/share/doc/"
+                              ,name "-" ,version)
+               (string-append "--with-fbconf=" out "/lib/firebird")
+               (string-append "--with-fbintl=" out "/lib/firebird/intl")
+               (string-append "--with-fbmisc=" out "/lib/firebird/misc")
+               (string-append "--with-fbmsg=" out "/lib/firebird")
+               (string-append "--with-fbplugins=" out "/lib/firebird/plugins")
+               (string-append "--with-fbudf=" out "/lib/firebird/UDF")
+               "--with-fbglock=/run/firebird"
+               "--with-fblog=/var/log/firebird"
+               "--with-fbhelp=/var/lib/firebird/system"
+               "--with-fbsecure-db=/var/lib/firebird/secure"
+               "--without-fbsample"
+               "--without-fbsample-db"
+               "--with-system-editline"))
+       #:make-flags
+       (list (string-append "CC=" ,(cc-for-target))
+             ;; The plugins/ can't find libfbclient otherwise.
+             (string-append "LDFLAGS=-Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib"))
+       #:tests? #f                      ; no test suite
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'use-system-boost
+           (lambda _
+             (substitute* "src/include/firebird/Message.h"
+               (("\"\\./impl/boost/preprocessor/seq/for_each_i\\.hpp\"")
+                "<boost/preprocessor/seq/for_each_i.hpp>")
+               (("FB_BOOST_") "BOOST_"))
+             #t))
+         (add-after 'unpack 'patch-installation
+           (lambda _
+             (substitute*
+                 "builds/install/arch-specific/linux/makeInstallImage.sh.in"
+               (("/bin/sh") (which "bash"))
+               ;; Remove shell script helpers from $PATH.
+               (("(addLibs|cp) .*\\.sh .*@FB_SBINDIR@") ":")
+               ;; Put files where Guix users expect them.
+               (("(License\\.txt.*)@FB_CONFDIR" match)
+                (string-append match "@FB_DOCDIR@"))
+               (("@FB_CONFDIR@(.*License\\.txt.*)" match)
+                (string-append "@FB_DOCDIR@" match))
+               (("(cp .*/doc/.*)@FB_CONFDIR@(.*)" _ head tail)
+                (string-append head "@FB_DOCDIR@" tail "\n")))
+             (substitute*
+                 (list "builds/install/posix-common/changeServerMode.sh.in"
+                       "builds/install/posix-common/install.sh.in")
+               ;; Skip phases that (could) cause problems in Guix.
+               (("check(InstallUser|IfServerRunning|Libraries)|addFirebirdUser")
+                ":")
+               ;; Skip phases that are merely pointless on Guix.
+               (("buildUninstallFile|installInitdScript|startFirebird") ":")
+               ;; Omit randomly generated password with bonus timestamp.
+               (("setDBAPassword") ":"))
+
+             ;; These promote proprietary workflows not relevant on Guix.
+             (for-each delete-file-recursively
+                       (find-files "doc" "README\\.(build\\.msvc|NT|Win)"))
+             #t))
+         (add-after 'configure 'delete-init-scripts
+           (lambda _
+             (delete-file-recursively "gen/install/misc")
+             #t))
+         (add-before 'build 'set-build-environment-variables
+           (lambda _
+             ;; ‘isql’ needs to run & find libfbclient.so during the build.
+             ;; This doubles as a rudimentary test in lieu of a test suite.
+             (setenv "LD_LIBRARY_PATH"
+                     (string-append (assoc-ref %build-inputs "icu4c") "/lib"))
+             #t))
+         (add-before 'install 'keep-embedded-debug-symbols
+           (lambda _
+             ;; Let the gnu-build-system separate & deal with them later.
+             ;; XXX Upstream would use ‘--strip-unneeded’, shaving a whole
+             ;; megabyte off Guix's 7.7M libEngine12.so, for example.
+             (substitute* "gen/Makefile.install"
+               (("readelf") "false"))
+             #t))
+         (add-after 'install 'prune-undesirable-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (with-directory-excursion out
+                 ;; Remove example binaries.
+                 (for-each delete-file-recursively
+                           (find-files "." "example"))
+                 ;; Delete (now-)empty directories.
+                 (for-each rmdir
+                           (list "include/firebird/impl"
+                                 "lib/firebird/plugins/udr"))
+                 #t)))))))
+    (inputs
+     `(("boost" ,boost)
+       ("editline" ,editline)
+       ("icu4c" ,icu4c-67)
+       ("libtommath" ,libtommath)
+       ("ncurses" ,ncurses)
+       ("zlib" ,zlib)))
+    (home-page "https://www.firebirdsql.org")
+    (synopsis "Relational database with many ANSI SQL standard features")
+    (description
+     "Firebird is an SQL @acronym{RDBMS, relational database management system}
+with rich support for ANSI SQL (e.g., @code{INSERT...RETURNING}) including
+@acronym{UDFs, user-defined functions} and PSQL stored procedures, cursors, and
+triggers.  Transactions provide full ACID-compliant referential integrity.
+
+The database requires very little manual maintenance once set up, making it
+ideal for small business or embedded use.
+
+When installed as a traditional local or remote (network) database server,
+Firebird can grow to terabyte scale with proper tuning---although PostgreSQL
+may be a better choice for such very large environments.
+
+Firebird can also be embedded into stand-alone applications that don't want or
+need a full client & server.  Used in this manner, it offers richer SQL support
+than SQLite as well as the option to seamlessly migrate to a client/server
+database later.")
+    (properties
+     `((lint-hidden-cve . ("CVE-2017-6369"))))
+    (license
+     ;; See doc/license/README.license.usage.txt for rationale & details.
+     (list license:bsd-3                ; src/common/sha2/
+           license:bsd-4                ; src/common/enc.cpp
+           license:gpl2+                ; builds/posix/make.defaults
+           (license:non-copyleft "file:///builds/install/misc/IPLicense.txt"
+                                 "InterBase Public License v1.0")
+           (license:non-copyleft "file:///builds/install/misc/IDPLicense.txt"
+                                 "Initial Developer's Public License v1.0")
+           license:lgpl2.1           ; exception for OSI-compatible licences
+           license:mpl1.1            ; examples/interfaces/0{6,8}*.cpp
+           license:public-domain)))) ; including files without explicit licence
+
 (define-public leveldb
   (package
     (name "leveldb")
@@ -334,14 +476,14 @@ mapping from string keys to string values.")
 (define-public memcached
   (package
     (name "memcached")
-    (version "1.5.20")
+    (version "1.6.9")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
              "https://memcached.org/files/memcached-" version ".tar.gz"))
        (sha256
-        (base32 "1r511qr95q0ywdaql3pdjiwzkfqxhhfzb13ilvl7mznfm4iv1myg"))))
+        (base32 "1lcjy1b9krnb2gk72qd1fvivlfiyfvknfi3wngyvyk9ifzijr9nm"))))
     (build-system gnu-build-system)
     (inputs
      `(("libevent" ,libevent)
@@ -385,7 +527,8 @@ applications.")
        ("cyrus-sasl" ,cyrus-sasl)))
     (outputs '("out" "doc"))
     (arguments
-     '(#:phases
+     '(#:tests? #f                      ;many tests fail and use too much time
+       #:phases
        (modify-phases %standard-phases
          (add-before 'bootstrap 'fix-configure.ac
            ;; Move the AC_CONFIG_AUX_DIR macro use under AC_INIT, otherwise we
@@ -397,24 +540,9 @@ applications.")
              (delete-file "bootstrap.sh") ;not useful in the context of Guix
              (substitute* "configure.ac"
                (("^AC_CONFIG_AUX_DIR\\(\\[build-aux\\]\\).*") "")
-               (("(^AC_INIT.*)" anchor)
-                (string-append anchor "AC_CONFIG_AUX_DIR([build-aux])\n")))
-             #t))
-         (add-before 'bootstrap 'disable-failing-tests
-           ;; See: https://bugs.launchpad.net/libmemcached/+bug/1803926
-           (lambda _
-             ;; Mark some heavily failing test suites as expected to fail.
-             (substitute* "Makefile.am"
-               (("(XFAIL_TESTS =[^\n]*)" xfail_tests)
-                (string-append xfail_tests " tests/testudp"
-                               " tests/libmemcached-1.0/testapp"
-                               " tests/libmemcached-1.0/testsocket")))
-             ;; Disable two tests of the unittest test suite.
-             (substitute* "libtest/unittest.cc"
-               ((".*echo_fubar_BINARY \\},.*") "")
-               ((".*application_doesnotexist_BINARY \\},.*") ""))
-             #t))
-         (add-after 'disable-dns-tests 'build-and-install-html-doc
+               (("^AC_INIT.*" anchor)
+                (string-append anchor "AC_CONFIG_AUX_DIR([build-aux])\n")))))
+         (add-before 'build 'build-and-install-html-doc
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((html (string-append (assoc-ref outputs "doc")
                                         "/share/doc/libmemcached/html/")))
@@ -422,9 +550,8 @@ applications.")
                ;; Cleanup useless files.
                (for-each delete-file-recursively
                          (map (lambda (x) (string-append html x))
-                              '("_sources" ".doctrees" ".buildinfo"))))
-             #t)))))
-    (home-page "https://libmemcached.org/")
+                              '("_sources" ".doctrees" ".buildinfo")))))))))
+    (home-page "https://libmemcached.org/libMemcached.html")
     (synopsis "C++ library for memcached")
     (description "libMemcached is a library to use memcached in C/C++
 applications.  It comes with a complete reference guide and documentation of
@@ -474,143 +601,6 @@ replacement for the code@{python-memcached} library.")
 (define-public python2-pylibmc
   (package-with-python2 python-pylibmc))
 
-(define-public mongodb
-  (package
-    (name "mongodb")
-    (version "3.4.10")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/mongodb/mongo/archive/r"
-                                  version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32 "0676lvkljj7a5hdhv78dbykqnqrj9lbn9799mi84b8vbnzsq961r"))
-              (modules '((guix build utils)))
-              (snippet
-               '(begin
-                  (for-each (lambda (dir)
-                              (delete-file-recursively
-                                (string-append "src/third_party/" dir)))
-                            '("pcre-8.41" "scons-2.5.0" "snappy-1.1.3"
-                              "valgrind-3.11.0" "wiredtiger"
-                              "yaml-cpp-0.5.3" "zlib-1.2.8"))
-                  #t))
-              (patches
-               (list
-                (search-patch "mongodb-support-unknown-linux-distributions.patch")))))
-    (build-system scons-build-system)
-    (inputs
-     `(("openssl" ,openssl-1.0)
-       ("pcre" ,pcre)
-        ,@(match (%current-system)
-            ((or "x86_64-linux" "aarch64-linux" "mips64el-linux")
-             `(("wiredtiger" ,wiredtiger)))
-            (_ `()))
-       ("yaml-cpp" ,yaml-cpp)
-       ("zlib" ,zlib)
-       ("snappy" ,snappy)))
-    (native-inputs
-     `(("valgrind" ,valgrind)
-       ("perl" ,perl)
-       ("python" ,python-2)
-       ("python2-pymongo" ,python2-pymongo)
-       ("python2-pyyaml" ,python2-pyyaml)
-       ("tzdata" ,tzdata-for-tests)))
-    (arguments
-     `(#:scons ,scons-python2
-       #:phases
-       (let ((common-options
-              `(;; "--use-system-tcmalloc" TODO: Missing gperftools
-                "--use-system-pcre"
-                ;; wiredtiger is 64-bit only
-                ,,(if (any (cute string-prefix? <> (or (%current-target-system)
-                                                       (%current-system)))
-                           '("i686-linux" "armhf-linux"))
-                    ``"--wiredtiger=off"
-                    ``"--use-system-wiredtiger")
-                ;; TODO
-                ;; build/opt/mongo/db/fts/unicode/string.o failed: Error 1
-                ;; --use-system-boost
-                "--use-system-snappy"
-                "--use-system-zlib"
-                "--use-system-valgrind"
-                ;; "--use-system-stemmer" TODO: Missing relevant package
-                "--use-system-yaml"
-                "--disable-warnings-as-errors"
-                ,(format #f "--jobs=~a" (parallel-job-count))
-                "--ssl")))
-         (modify-phases %standard-phases
-           (add-after 'unpack 'patch
-             (lambda _
-               ;; Remove use of GNU extensions in parse_number_test.cpp, to
-               ;; allow compiling with GCC 7 or later
-               ;; https://jira.mongodb.org/browse/SERVER-28063
-               (substitute* "src/mongo/base/parse_number_test.cpp"
-                 (("0xabcab\\.defdefP-10")
-                  "687.16784283419838"))
-               #t))
-           (add-after 'unpack 'scons-propagate-environment
-             (lambda _
-               ;; Modify the SConstruct file to arrange for
-               ;; environment variables to be propagated.
-               (substitute* "SConstruct"
-                 (("^env = Environment\\(")
-                  "env = Environment(ENV=os.environ, "))
-               #t))
-           (add-after 'unpack 'create-version-file
-             (lambda _
-               (call-with-output-file "version.json"
-                 (lambda (port)
-                   (display ,(simple-format #f "{
-    \"version\": \"~A\"
-}" version) port)))
-               #t))
-           (replace 'build
-             (lambda _
-               (apply invoke `("scons"
-                               ,@common-options
-                               "mongod" "mongo" "mongos"))))
-           (replace 'check
-             (lambda* (#:key tests? inputs #:allow-other-keys)
-               (setenv "TZDIR"
-                       (string-append (assoc-ref inputs "tzdata")
-                                      "/share/zoneinfo"))
-               (when tests?
-                 ;; Note that with the tests, especially the unittests, the
-                 ;; build can take up to ~45GB of space, as many tests are
-                 ;; individual executable files, with some being hundreds of
-                 ;; megabytes in size.
-                 (apply invoke `("scons" ,@common-options "dbtest" "unittests"))
-                 (substitute* "build/unittests.txt"
-                   ;; TODO: Don't run the async_stream_test, as it hangs
-                   (("^build\\/opt\\/mongo\\/executor\\/async\\_stream\\_test\n$")
-                    "")
-                   ;; TODO: This test fails
-                   ;; Expected 0UL != disks.size() (0 != 0) @src/mongo/util/procparser_test.cpp:476
-                   (("^build\\/opt\\/mongo\\/util\\/procparser\\_test\n$")
-                    ""))
-                 (invoke "python" "buildscripts/resmoke.py"
-                         "--suites=dbtest,unittests"
-                         (format #f  "--jobs=~a" (parallel-job-count))))
-               #t))
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
-                 (install-file "mongod" bin)
-                 (install-file "mongos" bin)
-                 (install-file "mongo" bin))
-               #t))))))
-    (home-page "https://www.mongodb.org/")
-    (synopsis "High performance and high availability document database")
-    (description
-     "Mongo is a high-performance, high availability, schema-free
-document-oriented database.  A key goal of MongoDB is to bridge the gap
-between key/value stores (which are fast and highly scalable) and traditional
-RDBMS systems (which are deep in functionality).")
-    (license (list license:agpl3
-                   ;; Some parts are licensed under the Apache License
-                   license:asl2.0))))
-
 (define-public mycli
   (package
     (name "mycli")
@@ -646,7 +636,7 @@ auto-completion and syntax highlighting.")
 (define-public mysql
   (package
     (name "mysql")
-    (version "5.7.27")
+    (version "5.7.33")
     (source (origin
              (method url-fetch)
              (uri (list (string-append
@@ -658,7 +648,7 @@ auto-completion and syntax highlighting.")
                           name "-" version ".tar.gz")))
              (sha256
               (base32
-               "1fhv16zr46pxm1j8vb8x8mh3nwzglg01arz8gnazbmjqldr5idpq"))))
+               "1bb343mf7n0qg2qz497gxjsqprygrjz1q1pbz76hgqxnsy08sfxd"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -716,7 +706,7 @@ Language.")
 (define-public mariadb
   (package
     (name "mariadb")
-    (version "10.5.6")
+    (version "10.5.8")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://downloads.mariadb.com/MariaDB"
@@ -724,7 +714,7 @@ Language.")
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1i257h0zdypdfj5wkg6ck9pxlkph0jvjs92k22pjr6gnx5lxs1gz"))
+                "1s3vfm73911cddjhgpcbkya6nz7ag2zygg56qqzwscn5ybv28j7b"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -745,6 +735,7 @@ Language.")
                             (append (find-files "extra/wolfssl")
                                     (find-files "zlib")))
                   #t))))
+    (replacement mariadb/fixed)
     (build-system cmake-build-system)
     (outputs '("out" "lib" "dev"))
     (arguments
@@ -774,6 +765,10 @@ Language.")
          "-DDEFAULT_COLLATION=utf8_general_ci"
          "-DMYSQL_DATADIR=/var/lib/mysql"
          "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
+
+         ;; Do not install the benchmark suite.
+         "-DINSTALL_SQLBENCHDIR=false"
+
          (string-append "-DCMAKE_INSTALL_PREFIX=" (assoc-ref %outputs "lib"))
          (string-append "-DCMAKE_INSTALL_RPATH=" (assoc-ref %outputs "lib")
                         "/lib")
@@ -803,14 +798,26 @@ Language.")
              ;; to other variables such as $INSTALL_INCLUDEDIR, which does
              ;; not work when the latter uses an absolute file name.
              (substitute* "libmariadb/mariadb_config/mariadb_config.c.in"
-               (("@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@")
-                "@INSTALL_INCLUDEDIR@"))
+               (("%s/@INSTALL_INCLUDEDIR@")
+                (string-append "@INSTALL_INCLUDEDIR@"))
+               ;; As of 10.5.8, the mariadb_config program tries to be
+               ;; clever and computes the installation directory relative
+               ;; to /proc/self/exe when running on Linux.  Make it fall
+               ;; back to the old behaviour.
+               (("defined\\(__linux__\\)")
+                "0"))
              (substitute* "libmariadb/mariadb_config/libmariadb.pc.in"
                (("\\$\\{prefix\\}/@INSTALL_INCLUDEDIR@")
                 "@INSTALL_INCLUDEDIR@"))
+             (substitute* "support-files/mariadb.pc.in"
+               (("^(include|bin|script|doc|man)dir=\\$\\{prefix\\}/" _ dir)
+                (string-append dir "dir=")))
              (substitute* "include/CMakeLists.txt"
                (("\\\\\\$\\{CMAKE_INSTALL_PREFIX\\}/\\$\\{INSTALL_INCLUDEDIR\\}")
                 "${INSTALL_INCLUDEDIR}"))
+             (substitute* "cmake/mariadb_connector_c.cmake"
+               (("\\\\\\$\\{CMAKE_INSTALL_PREFIX\\}/\\$\\{INSTALL_BINDIR\\}")
+                "${INSTALL_BINDIR}"))
              #t))
          (add-after 'unpack 'adjust-tests
            (lambda _
@@ -823,8 +830,21 @@ Language.")
                       "main.explain_non_select"
                       "main.stat_tables"
                       "main.stat_tables_innodb"
+                      "main.upgrade_MDEV-19650"
                       "roles.acl_statistics"
 
+                      ;; FIXME: This test checks various table encodings and
+                      ;; fails because Guix defaults to UTF8 instead of the
+                      ;; upstream default latin1_swedish_ci.  It's not easily
+                      ;; substitutable because several encodings are tested.
+                      "main.sp2"
+
+                      ;; XXX: This test occasionally fails on i686-linux:
+                      ;; <https://jira.mariadb.org/browse/MDEV-24458>
+                      ,@(if (string-prefix? "i686" (%current-system))
+                            '("main.myisampack")
+                            '())
+
                       ;; This file contains a time bomb which makes it fail after
                       ;; 2030-12-31.  See <https://bugs.gnu.org/34351> for details.
                       "main.mysqldump"))
@@ -895,12 +915,12 @@ Language.")
                 (("\\$basedir/share/mysql")
                  (string-append lib "/share/mysql")))
 
-              ;; Remove unneeded files for testing.
               (with-directory-excursion lib
-                (for-each delete-file-recursively
-                          '("mysql-test" "sql-bench"))
-                ;; And static libraries.
+                ;; Remove tests.
+                (delete-file-recursively "mysql-test")
+                ;; Remove static libraries.
                 (for-each delete-file (find-files "lib" "\\.a$")))
+
               (with-directory-excursion out
                 (delete-file "share/man/man1/mysql-test-run.pl.1")
                 ;; Delete huge and unnecessary executables.
@@ -951,19 +971,27 @@ Language.")
 as a drop-in replacement of MySQL.")
     (license license:gpl2)))
 
+(define mariadb/fixed
+  (package
+    (inherit mariadb)
+    (source (origin
+              (inherit (package-source mariadb))
+              (patches (search-patches "mariadb-CVE-2021-27928.patch"))))))
+
 (define-public mariadb-connector-c
   (package
     (name "mariadb-connector-c")
-    (version "3.1.10")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://downloads.mariadb.org/f/connector-c-"
-                    version "/mariadb-connector-c-"
-                    version "-src.tar.gz"))
-              (sha256
-               (base32
-                "13v5z4w1cl890lnr2fbwbziw638lqw2aga45vdq1z0cyrc9mcgmg"))))
+    (version "3.1.12")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://downloads.mariadb.org/f/connector-c-" version
+             "/mariadb-connector-c-" version "-src.tar.gz"
+             "/from/https%3A//mirrors.ukfast.co.uk/sites/mariadb/?serve"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0qzyahr8x9l1xz0l79wz3iahxz7648n1azc5yr7kx0dl113y2nig"))))
     (inputs
      `(("openssl" ,openssl)))
     (build-system cmake-build-system)
@@ -975,22 +1003,53 @@ as a drop-in replacement of MySQL.")
 developed in C/C++ to MariaDB and MySQL databases.")
     (license license:lgpl2.1+)))
 
+(define-public galera
+  (package
+    (name "galera")
+    (version "26.4.7")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (commit "bac8171266cb982fe013ce496d78085438c6f23e")
+                    (url "https://github.com/codership/galera")
+                    (recursive? #t)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "0h7s670pcasq8wzprhyxqfca2cghi62b8xz2kikb2a86wd453qil"))))
+    (build-system cmake-build-system)
+    (inputs
+     `(("check" ,check)
+       ("boost" ,boost)
+       ("openssl" ,openssl)))
+    (home-page "https://github.com/codership/galera/")
+    (synopsis "Extension to the MariaDB database server")
+    (description
+     "Galera is a wsrep-provider that is used with MariaDB for load-balancing
+and high-availability (HA).")
+    (license license:gpl2)))                  ;'COPYING' says "version 2" only
+
 ;; Don't forget to update the other postgresql packages when upgrading this one.
-(define-public postgresql
+(define-public postgresql-13
   (package
     (name "postgresql")
-    (version "10.13")
+    (replacement postgresql-13.2)
+    (version "13.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://ftp.postgresql.org/pub/source/v"
                                   version "/postgresql-" version ".tar.bz2"))
               (sha256
                (base32
-                "1qal0yp7a90yzya7hl56gsmw5fvacplrdhpn7h9gnbyr1i2iyw2d"))
+                "07z6zwr58dckaa97yl9ml240z83d1lhgaxw9aq49i8lsp21mqd0j"))
               (patches (search-patches "postgresql-disable-resolve_symlinks.patch"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--with-uuid=e2fs" "--with-openssl")
+     `(#:configure-flags '("--with-uuid=e2fs" "--with-openssl"
+                           ;; PostgreSQL installs its own Makefile (should it?).
+                           ;; Prevent it from retaining needless references to
+                           ;; the build tools in order to save size.
+                           "MKDIR_P=mkdir -p" "INSTALL_BIN=install -c"
+                           "LD=ld" "TAR=tar")
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'patch-/bin/sh
@@ -1022,31 +1081,141 @@ TIMESTAMP.  It also supports storage of binary large objects, including
 pictures, sounds, or video.")
     (license (license:x11-style "file://COPYRIGHT"))))
 
-(define-public postgresql-11
+(define-public postgresql-13.2
   (package
-    (inherit postgresql)
+    (inherit postgresql-13)
     (name "postgresql")
-    (version "11.6")
+    (version "13.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://ftp.postgresql.org/pub/source/v"
                                   version "/postgresql-" version ".tar.bz2"))
               (sha256
                (base32
-                "0w1iq488kpzfgfnlw4k32lz5by695mpnkq461jrgsr99z5zlz4j9"))))))
+                "1z5d847jnajcfr3wa6jn52a8xjhamvwzmz18xlm5nvxqip8grmsz"))
+              (patches (search-patches "postgresql-disable-resolve_symlinks.patch"))))))
 
-(define-public postgresql-9.6
+(define-public postgresql-11
   (package
-    (inherit postgresql)
+    (inherit postgresql-13)
     (name "postgresql")
-    (version "9.6.16")
+    (version "11.11")
     (source (origin
-              (method url-fetch)
+              (inherit (package-source postgresql-13))
+              (uri (string-append "https://ftp.postgresql.org/pub/source/v"
+                                  version "/postgresql-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0v0qk298nxmpzpgsxcsxma328hdkyzd7fwjs0zsn6zavl5zpnq20"))))))
+
+(define-public postgresql-10
+  (package
+    (inherit postgresql-11)
+    (version "10.16")
+    (source (origin
+              (inherit (package-source postgresql-11))
+              (uri (string-append "https://ftp.postgresql.org/pub/source/v"
+                                  version "/postgresql-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1cvv8qw0gkkczqhiwx6ns7w88dwkvdz4cvb2d4ff14363f5p2p53"))))))
+
+(define-public postgresql-9.6
+  (package
+    (inherit postgresql-10)
+    (version "9.6.21")
+    (source (origin
+              (inherit (package-source postgresql-10))
               (uri (string-append "https://ftp.postgresql.org/pub/source/v"
                                   version "/postgresql-" version ".tar.bz2"))
               (sha256
                (base32
-                "1rr2dgv4ams8r2lp13w85c77rkmzpb88fjlc28mvlw6zq2fblv2w"))))))
+                "0d0ngpadf1i7c0i2psaxcbmiwx8334ibcsn283n9fp4853pyl3wk"))))))
+
+(define-public postgresql postgresql-13)
+
+(define-public pgloader
+  (package
+    (name "pgloader")
+    (version "3.6.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/dimitri/pgloader")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "06i1jd2za3ih5caj2b4vzlzags5j65vv8dfdbz0ggdrp40wfd5lh"))
+       (file-name (git-file-name name version))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; NOTE: (Sharlatan-20210119T211511+0000) Tests are disabled due to being
+     ;; dependent on Quicklisp, main build target is `pgloader-standalone' which
+     ;; does not require Quicklisp workarounds. There is no `install' target
+     ;; configured in Makefile.
+     `(#:tests? #f
+       #:strip-binaries? #f
+       #:make-flags
+       (list "pgloader-standalone" "BUILDAPP_SBCL=buildapp")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'set-home
+           (lambda _
+             (setenv "HOME" "/tmp")
+             #t))
+         (add-after 'unpack 'patch-Makefile
+           (lambda _
+             (substitute* "Makefile"
+               (("--sbcl.*") "--sbcl $(CL) --asdf-path . \\\n"))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
+               (mkdir-p bin)
+               (install-file "build/bin/pgloader"  bin))
+             #t)))))
+    (native-inputs
+     `(("buildapp" ,buildapp)
+       ("sbcl" ,sbcl)))
+    (inputs
+     `(("alexandria" ,sbcl-alexandria)
+       ("cl-abnf" ,sbcl-cl-abnf)
+       ("cl-base64" ,sbcl-cl-base64)
+       ("cl-csv" ,sbcl-cl-csv)
+       ("cl-fad" ,sbcl-cl-fad)
+       ("cl-log" ,sbcl-cl-log)
+       ("cl-markdown" ,sbcl-cl-markdown)
+       ("cl-mustache" ,sbcl-cl-mustache)
+       ("cl-ppcre" ,sbcl-cl-ppcre)
+       ("cl-sqlite" ,sbcl-cl-sqlite)
+       ("closer-mop" ,sbcl-closer-mop)
+       ("command-line-arguments" ,sbcl-command-line-arguments)
+       ("db3" ,sbcl-db3)
+       ("drakma" ,sbcl-drakma)
+       ("esrap" ,sbcl-esrap)
+       ("flexi-streams" ,sbcl-flexi-streams)
+       ("ixf" ,sbcl-ixf)
+       ("local-time" ,sbcl-local-time)
+       ("lparallel" ,sbcl-lparallel)
+       ("metabang-bind" ,sbcl-metabang-bind)
+       ("mssql" ,sbcl-mssql)
+       ("postmodern" ,sbcl-postmodern)
+       ("py-configparser" ,sbcl-py-configparser)
+       ("qmynd" ,sbcl-qmynd)
+       ("quri" ,sbcl-quri)
+       ("split-sequence" ,sbcl-split-sequence)
+       ("trivial-backtrace" ,sbcl-trivial-backtrace)
+       ("usocket" ,sbcl-usocket)
+       ("uuid" ,sbcl-uuid)
+       ("yason" ,sbcl-yason)
+       ("zs3" ,sbcl-zs3)))
+    (home-page "https://pgloader.io/")
+    (synopsis "Tool to migrate data to PostgreSQL")
+    (description
+     "@code{pgloader} is a program that can load data or migrate databases from
+CSV, DB3, iXF, SQLite, MS-SQL or MySQL to PostgreSQL.")
+    (license (license:x11-style "file://LICENSE"))))
 
 (define-public python-pymysql
   (package
@@ -1124,12 +1293,12 @@ organized in a hash table or B+ tree.")
     (native-inputs `(("bc" ,bc)
                      ("bash:include" ,bash "include")
                      ("check" ,check-0.14)
-                     ("libuuid" ,util-linux)
                      ("pkg-config" ,pkg-config)))
 
     ;; TODO: Add more optional inputs.
     (inputs `(("curl" ,curl)
-              ("libgcrypt" ,libgcrypt)))
+              ("libgcrypt" ,libgcrypt)
+              ("libuuid" ,util-linux "lib")))
     (synopsis "Manipulate plain text files as databases")
     (description
      "GNU Recutils is a set of tools and libraries for creating and
@@ -1186,6 +1355,7 @@ including field and record folding.")))
      `(#:make-flags (list "CC=gcc" "V=1"
                           ;; Ceph requires that RTTI is enabled.
                           "USE_RTTI=1"
+                          "date=1970-01-01" ; build reproducibly
                           (string-append "INSTALL_PATH="
                                          (assoc-ref %outputs "out"))
 
@@ -1903,6 +2073,35 @@ Driver.")
    ;; COPYING contains copy of lgpl2.1 - but copyright notices just say "LGPL"
    (home-page "http://www.unixodbc.org")))
 
+(define-public nanodbc
+  (package
+    (name "nanodbc")
+    (version "2.13.0")
+    (source (origin
+              (method git-fetch)
+              (uri
+               (git-reference
+                (url "https://github.com/nanodbc/nanodbc")
+                (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1q80p7yv9mcl4hyvnvcjdr70y8nc940ypf368lp97vpqn5yckkgm"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       ;; The tests require ODBC backends to be installed.
+       (list "-DNANODBC_DISABLE_TESTS=ON")
+       #:tests? #false))
+    (inputs
+     `(("unixodbc" ,unixodbc)))
+    (home-page "https://nanodbc.io/")
+    (synopsis "C++ wrapper for the native C ODBC API")
+    (description "The goal for nanodbc is to make developers happy by providing
+a simpler and less verbose API for working with ODBC.  Common tasks should be
+easy, requiring concise and simple code.")
+    (license license:expat)))
+
 (define-public unqlite
   (package
     (name "unqlite")
@@ -1932,19 +2131,43 @@ similar to BerkeleyDB, LevelDB, etc.")
 (define-public redis
   (package
     (name "redis")
-    (version "5.0.7")
+    (version "6.0.11")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://download.redis.io/releases/redis-"
                                   version".tar.gz"))
               (sha256
                (base32
-                "0ax8sf3vw0yadr41kzc04917scrg5wir1d94zmbz00b8pzm79nv1"))))
+                "0prwqap452m581nyc3cz642d1z3x9nd81896hlqdm3z8238z49y9"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete bundled jemalloc, as the package will use the libc one
+               '(begin (delete-file-recursively "deps/jemalloc")
+                       #t))))
     (build-system gnu-build-system)
+    (native-inputs
+     `(("procps" ,procps) ; for tests
+       ("tcl" ,tcl)))     ; for tests
     (arguments
-     '(#:tests? #f ; tests related to master/slave and replication fail
-       #:phases (modify-phases %standard-phases
-                  (delete 'configure))
+     '(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'use-correct-tclsh
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "runtest"
+               (("^TCLSH=.*")
+                (string-append "TCLSH="
+                               (assoc-ref inputs "tcl")
+                               "/bin/tclsh")))
+             #t))
+         (add-after 'unpack 'adjust-tests
+           (lambda _
+             ;; Disable failing tests
+             (substitute* "tests/test_helper.tcl"
+               (("    integration/replication[^-]") "")
+               (("    integration/replication-4") "")
+               (("    integration/replication-psync") ""))
+             #t)))
        #:make-flags `("CC=gcc"
                       "MALLOC=libc"
                       "LDFLAGS=-ldl"
@@ -1960,14 +2183,14 @@ sets, bitmaps and hyperloglogs.")
 (define-public kyotocabinet
   (package
     (name "kyotocabinet")
-    (version "1.2.78")
+    (version "1.2.79")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://fallabs.com/kyotocabinet/pkg/"
                                   "kyotocabinet-" version ".tar.gz"))
               (sha256
                (base32
-                "1bxkf9kmcavq9rqridb8mvmrk3hj4447ffi24m2admsbm61n6k29"))))
+                "079ymsahlrijswgwfr2la9yw5h57l752cprhp5dz31iamsj1vyv7"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
@@ -2107,14 +2330,14 @@ database.")
 (define-public perl-db-file
  (package
   (name "perl-db-file")
-  (version "1.854")
+  (version "1.855")
   (source
     (origin
       (method url-fetch)
       (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/DB_File-"
                           version ".tar.gz"))
       (sha256
-        (base32 "0fv0any5am6vr6h1wcwhnraj70hd55fs4d8c2y7chsc9alf9di5y"))))
+        (base32 "0q599h7g4jkzks5dxf1zifx9k7l9vif26r2dlgkzxkg6bfif5zyr"))))
   (build-system perl-build-system)
   (inputs `(("bdb" ,bdb)))
   (native-inputs `(("perl-test-pod" ,perl-test-pod)))
@@ -2135,7 +2358,7 @@ database.")
 (define-public lmdb
   (package
     (name "lmdb")
-    (version "0.9.26")
+    (version "0.9.28")
     (source
      (origin
        (method git-fetch)
@@ -2144,7 +2367,7 @@ database.")
              (commit (string-append "LMDB_" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0323xwb2rqyrr9vr6gbxc2kl89drhqw0ifmyh9pg9qgqmymyhxdx"))))
+        (base32 "012a8bs49cswsnzw7k4piis5b6dn4by85w7a7mai9i04xcjyy9as"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
@@ -2155,7 +2378,25 @@ database.")
              (chdir "libraries/liblmdb")
              (substitute* "Makefile"
                (("/usr/local") (assoc-ref outputs "out")))
-            #t)))))
+            #t))
+         (add-after 'install 'create-pkg-config-file
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/lib/pkgconfig"))
+               (with-output-to-file (string-append out "/lib/pkgconfig/liblmdb.pc")
+                 (lambda _
+                   (format #t "prefix=~a~@
+                           exec_prefix=~a~@
+                           libdir=~a/lib~@
+                           includedir=~a/include~@
+                           ~@
+                           Name: liblmdb~@
+                           Version: ~a~@
+                           Description: Lightning Memory-Mapped Database library~@
+                           Libs: -L${libdir} -llmdb~@
+                           Cflags: -I${includedir}~%"
+                           out out out out ,version)))
+                 #t))))))
     (home-page "https://symas.com/lmdb/")
     (synopsis "Lightning Memory-Mapped Database library")
     (description
@@ -2236,17 +2477,18 @@ on another machine, accessed via TCP/IP.")
 (define-public python-peewee
   (package
     (name "python-peewee")
-    (version "3.9.6")
-      (source
-        (origin
-        (method url-fetch)
-        (uri (pypi-uri "peewee" version))
-        (sha256
-         (base32
-          "1j4sh946k0736m7pd54z0y6i2hjhgg3kdllx1pwq8xkzzcgrx1xw"))))
+    (version "3.14.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "peewee" version))
+       (sha256
+        (base32 "1yl49gxrg0c2x3n3r60z3lixw9am8b61s0477l9vjabhhx1yziar"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f)) ; Fails to import test data
+     `(#:tests? #f))                    ; fails to import test data
+    (inputs
+     `(("sqlite" ,sqlite)))
     (native-inputs
      `(("python-cython" ,python-cython)))
     (home-page "https://github.com/coleifer/peewee/")
@@ -2265,17 +2507,28 @@ can autogenerate peewee models using @code{pwiz}, a model generator.")
 (define-public python-tortoise-orm
   (package
     (name "python-tortoise-orm")
-    (version "0.16.7")
+    (version "0.16.21")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "tortoise-orm" version))
        (sha256
         (base32
-         "0wr7p4v0b16ypm9fcpwpl99kf491m6w3jkd13xcsgq13fy73fbqc"))))
+         "1dallk0q8q4v37klm0v3rppf2w8sjkqmypc1w8r9rraqxg1ylacp"))))
     (build-system python-build-system)
-    ;; Disable tests for now. They pull in a lot of dependencies.
-    (arguments `(#:tests? #f))
+    (arguments
+     `(#:tests? #f ; Pypi does not have tests and Git snapshot depends on
+                   ; poetry.
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'relax-version-requirements
+                    (lambda _
+                      (substitute* "setup.py"
+                        (("pypika>=0\\.44\\.0,<0\\.45\\.0") "pypika")
+                        (("aiosqlite>=0.16.0,<0.17.0") "aiosqlite")
+                        (("pytz>=2020\\.4,<2021\\.0") "pytz")
+                        ;; Not required, since ciso8601 is used.
+                        (("'iso8601>=0\\.1\\.13,<0\\.2\\.0',") ""))
+                      #t)))))
     (native-inputs
      `(("python-asynctest" ,python-asynctest)
        ("python-nose2" ,python-nose2)))
@@ -2283,6 +2536,7 @@ can autogenerate peewee models using @code{pwiz}, a model generator.")
      `(("python-aiosqlite" ,python-aiosqlite)
        ("python-pypika" ,python-pypika)
        ("python-ciso8601" ,python-ciso8601)
+       ("python-pytz" ,python-pytz)
        ("python-typing-extensions"
         ,python-typing-extensions)))
     (home-page
@@ -2619,13 +2873,13 @@ Database API 2.0T.")
 (define-public python-sqlalchemy
   (package
     (name "python-sqlalchemy")
-    (version "1.3.18")
+    (version "1.3.20")
     (source
      (origin
       (method url-fetch)
       (uri (pypi-uri "SQLAlchemy" version))
       (sha256
-       (base32 "1rwc6ss1cnz3kxx0p9p6xw0w79r8qw03lcc29k31yb3rcigvfbys"))))
+       (base32 "18b9am7bsqc4nj3d2h5r93i002apczxfvpfpcqbd6f0385zmrwnj"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-cython" ,python-cython) ; for C extensions
@@ -2860,15 +3114,25 @@ translate the complete SQLite API into Python.")
 (define-public python-aiosqlite
   (package
     (name "python-aiosqlite")
-    (version "0.12.0")
+    (version "0.17.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "aiosqlite" version))
        (sha256
         (base32
-         "1w8248yz85xyzvvh4jaxnc59fqil45aka6h82kn1rcih4rjxbnn1"))))
+         "0lgfpbkcd730hbgj3zlrbx2y8fzvdns2zj3s4r4l31n49g1arrph"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (if tests?
+                          (invoke "python" "-m" "unittest" "aiosqlite.tests")
+                          (format #t "test suite not run~%"))
+                      #t)))))
+    (propagated-inputs
+     `(("python-typing-extensions" ,python-typing-extensions)))
     (native-inputs
      `(("python-aiounittest" ,python-aiounittest)))
     (home-page "https://github.com/jreese/aiosqlite")
@@ -2976,6 +3240,36 @@ database).")
 (define-public python2-sadisplay
   (package-with-python2 python-sadisplay))
 
+(define-public yoyo-migrations
+  (package
+    (name "yoyo-migrations")
+    (version "7.2.0")
+    (source
+     (origin
+       ;; We use the upstream repository, as the tests are not included in the
+       ;; PyPI releases.
+       (method hg-fetch)
+       (uri (hg-reference
+             (url "https://hg.sr.ht/~olly/yoyo")
+             (changeset (string-append "v" version "-release"))))
+       (file-name (string-append name "-" version "-checkout"))
+       (sha256
+        (base32 "0q2z9bgdj3wyix7yvqsayfs21grp5av8ilh411lgmjhigszkvhcq"))))
+    (build-system python-build-system)
+    (arguments
+     ;; XXX: Tests require a connection to some pgsql database and psycopg
+     ;; fails to connect to it.
+     '(#:tests? #f))
+    (propagated-inputs
+     `(("python-sqlparse" ,python-sqlparse)
+       ("python-tabulate" ,python-tabulate)))
+    (home-page "https://ollycope.com/software/yoyo/latest/")
+    (synopsis "Database migrations with SQL")
+    (description
+     "Yoyo is a database schema migration tool.  Migrations are written as SQL
+files or Python scripts that define a list of migration steps.")
+    (license license:asl2.0)))
+
 (define-public python-mysqlclient
   (package
     (name "python-mysqlclient")
@@ -2990,8 +3284,7 @@ database).")
     (build-system python-build-system)
     (arguments '(#:tests? #f))          ;XXX: requires a live database
     (inputs
-     `(("mysql" ,mariadb "lib")
-       ("mysql-dev" ,mariadb "dev")))
+     `(("mysql-dev" ,mariadb "dev")))
     (home-page "https://github.com/PyMySQL/mysqlclient-python")
     (synopsis "MySQLdb is an interface to the popular MySQL database server for Python")
     (description "MySQLdb is an interface to the popular MySQL database server
@@ -3127,9 +3420,6 @@ processing them in the background with workers.  It is backed by Redis and it
 is designed to have a low barrier to entry.")
     (license license:bsd-2)))
 
-(define-public python2-rq
-  (package-with-python2 python-rq))
-
 (define-public python-rq-scheduler
   (package
     (name "python-rq-scheduler")
@@ -3242,7 +3532,7 @@ transforms idiomatic python function calls to well-formed SQL queries.")
 (define-public python-pypika
   (package
     (name "python-pypika")
-    (version "0.37.2")
+    (version "0.47.6")
     (source
      (origin (method git-fetch)
              (uri (git-reference
@@ -3251,7 +3541,7 @@ transforms idiomatic python function calls to well-formed SQL queries.")
              (file-name (git-file-name name version))
              (sha256
               (base32
-               "089z1c778q1fwhzsc88ws8j5gm2hgxknibabn4wpax8rz2bfs3ck"))))
+               "001pg36sw9a36zdd1kccbymcxndphjcjbbrsy6ri7ng8h4dgz549"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-parameterized" ,python-parameterized)))
@@ -3262,127 +3552,12 @@ transforms idiomatic python function calls to well-formed SQL queries.")
 the SQL language using a syntax that reflects the resulting query.")
     (license license:asl2.0)))
 
-(define-public mongo-tools
-  (package
-    (name "mongo-tools")
-    (version "3.4.0")
-    (source
-     (origin (method git-fetch)
-             (uri (git-reference
-                   (url "https://github.com/mongodb/mongo-tools")
-                   (commit (string-append "r" version))))
-             (file-name (git-file-name name version))
-             (sha256
-              (base32
-               "1bcsz5cvj39a7nsxsfqmz9igrw33j6yli9kffigqyscs52amw7x1"))))
-    (build-system go-build-system)
-    (arguments
-     `(#:import-path "github.com/mongodb/mongo-tools"
-       #:modules ((srfi srfi-1)
-                  (guix build go-build-system)
-                  (guix build utils))
-       #:install-source? #f
-       #:phases
-       (let ((all-tools
-              '("bsondump" "mongodump" "mongoexport" "mongofiles"
-                "mongoimport" "mongooplog" "mongorestore"
-                "mongostat" "mongotop")))
-         (modify-phases %standard-phases
-           (add-after 'unpack 'delete-bundled-source-code
-             (lambda _
-               (delete-file-recursively
-                "src/github.com/mongodb/mongo-tools/vendor")
-               #t))
-           (add-after 'delete-bundled-source-code 'patch-source
-             (lambda _
-               ;; Remove a redundant argument that causes compilation to fail.
-               (substitute*
-                   "src/github.com/mongodb/mongo-tools/mongorestore/filepath.go"
-                 (("skipping restore of system.profile collection\", db)")
-                  "skipping restore of system.profile collection\")"))
-               #t))
-           (replace 'build
-             (lambda _
-               (for-each (lambda (tool)
-                           (let ((command
-                                  `("go" "build"
-                                    ;; This is where the tests expect to find the
-                                    ;; executables
-                                    "-o" ,(string-append
-                                           "src/github.com/mongodb/mongo-tools/bin/"
-                                           tool)
-                                    "-v"
-                                    "-tags=\"ssl sasl\""
-                                    "-ldflags"
-                                    "-extldflags=-Wl,-z,now,-z,relro"
-                                    ,(string-append
-                                      "src/github.com/mongodb/mongo-tools/"
-                                      tool "/main/" tool ".go"))))
-                             (simple-format #t "build: running ~A\n"
-                                            (string-join command))
-                             (apply invoke command)))
-                         all-tools)
-               #t))
-           (replace 'check
-             (lambda _
-               (with-directory-excursion "src"
-                 (for-each (lambda (tool)
-                             (invoke
-                              "go" "test" "-v"
-                              (string-append "github.com/mongodb/mongo-tools/"
-                                             tool)))
-                           all-tools))
-               #t))
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (for-each (lambda (tool)
-                           (install-file
-                            (string-append "src/github.com/mongodb/mongo-tools/bin/"
-                                           tool)
-                            (string-append (assoc-ref outputs "out")
-                                           "/bin")))
-                         all-tools)
-               #t))))))
-    (native-inputs
-     `(("go-github.com-howeyc-gopass" ,go-github.com-howeyc-gopass)
-       ("go-github.com-jessevdk-go-flags" ,go-github.com-jessevdk-go-flags)
-       ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
-       ("go-gopkg.in-mgo.v2" ,go-gopkg.in-mgo.v2)
-       ("go-gopkg.in-tomb.v2" ,go-gopkg.in-tomb.v2)
-       ("go-github.com-nsf-termbox-go" ,go-github.com-nsf-termbox-go)
-       ("go-github.com-smartystreets-goconvey" ,go-github.com-smartystreets-goconvey)))
-    (home-page "https://github.com/mongodb/mongo-tools")
-    (synopsis "Various tools for interacting with MongoDB and BSON")
-    (description
-     "This package includes a collection of tools related to MongoDB.
-@table @code
-@item bsondump
-Display BSON files in a human-readable format
-@item mongoimport
-Convert data from JSON, TSV or CSV and insert them into a collection
-@item mongoexport
-Write an existing collection to CSV or JSON format
-@item mongodump/mongorestore
-Dump MongoDB backups to disk in the BSON format
-@item mongorestore
-Read MongoDB backups in the BSON format, and restore them to a live database
-@item mongostat
-Monitor live MongoDB servers, replica sets, or sharded clusters
-@item mongofiles
-Read, write, delete, or update files in GridFS
-@item mongooplog
-Replay oplog entries between MongoDB servers
-@item mongotop
-Monitor read/write activity on a mongo server
-@end table")
-    (license license:asl2.0)))
-
 ;; There are many wrappers for this in other languages. When touching, please
 ;; be sure to ensure all dependencies continue to build.
 (define-public apache-arrow
   (package
     (name "apache-arrow")
-    (version "0.17.1")
+    (version "3.0.0")
     (source
      (origin
        (method git-fetch)
@@ -3392,7 +3567,7 @@ Monitor read/write activity on a mongo server
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "02r6yx3yhywzikd3b0vfkjgddhfiriyx2vpm3jf5880wq59x798a"))))
+         "03ngddh3r1g6f9aja2jlfksgvgyzmxmfy4bxvzjrcv5fvl5x8ii0"))))
     (build-system cmake-build-system)
     (arguments
      `(#:tests? #f
@@ -3470,23 +3645,24 @@ Monitor read/write activity on a mongo server
              ;;"-DBENCHMARK_ENABLE_TESTING=OFF"
              "-DARROW_BUILD_STATIC=OFF")))
     (inputs
-     `(("boost" ,boost)
+     `(("apache-thrift" ,apache-thrift "lib")
+       ("boost" ,boost)
        ("brotli" ,google-brotli)
+       ("bzip2" ,bzip2)
        ("double-conversion" ,double-conversion)
-       ("snappy" ,snappy)
        ("gflags" ,gflags)
        ("glog" ,glog)
-       ("apache-thrift" ,apache-thrift "lib")
+       ("grpc" ,grpc)
+       ("lz4" ,lz4)
        ("protobuf" ,protobuf)
+       ("python-3" ,python)
+       ("python-numpy" ,python-numpy)
        ("rapidjson" ,rapidjson)
-       ("zlib" ,zlib)
-       ("bzip2" ,bzip2)
-       ("lz4" ,lz4)
-       ("zstd" ,zstd "lib")
        ("re2" ,re2)
-       ("grpc" ,grpc)
-       ("python-3" ,python)
-       ("python-numpy" ,python-numpy)))
+       ("snappy" ,snappy)
+       ("utf8proc" ,utf8proc)
+       ("zlib" ,zlib)
+       ("zstd" ,zstd "lib")))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (outputs '("out" "lib" "include"))
@@ -3536,9 +3712,6 @@ implementation, along with tools for interoperability with pandas, NumPy, and
 other traditional Python scientific computing packages.")
     (license license:asl2.0)))
 
-(define-public python2-pyarrow
-  (package-with-python2 python-pyarrow))
-
 (define-public python-crate
   (package
     (name "python-crate")
@@ -3624,6 +3797,7 @@ simultaneous database connections by using this framework.")
                "--with-sqlite3"
                (string-append "--with-sqlite-incdir=" sqlite "/include")
                (string-append "--with-sqlite-libdir=" sqlite "/lib")))
+       #:tests? #f  ; FIXME: Find why the tests get stuck forever.
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'fix-tests
@@ -3656,7 +3830,7 @@ The drivers officially supported by @code{libdbi} are:
 (define-public soci
   (package
     (name "soci")
-    (version "4.0.0")
+    (version "4.0.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -3665,27 +3839,48 @@ The drivers officially supported by @code{libdbi} are:
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "06faswdxd2frqr9xnx6bxc7zwarlzsbdi3bqpz7kwdxsjvq41rnb"))))
+                "14x2gjblkgpflv75wl144cyjp1sis5rbxnr9r2gj3yw16v2av0bp"))))
     (build-system cmake-build-system)
-    (inputs
-     `(("postgresql" ,postgresql)
+    (propagated-inputs
+     ;; Headers of soci has include-references to headers of these inputs.
+     `(("firebird" ,firebird)
+       ("postgresql" ,postgresql)
        ("sqlite" ,sqlite)
        ("odbc" ,unixodbc)
        ("boost" ,boost)
-       ("mariadb:dev" ,mariadb "dev")
-       ("mariadb:lib" ,mariadb "lib")))
+       ("mariadb:dev" ,mariadb "dev")))
     (arguments
-     `(#:tests? #f ; Tests may require running database management systems.
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-lib-path
-           (lambda _
-             (substitute* "CMakeLists.txt"
-               (("set\\(SOCI_LIBDIR \"lib64\"\\)") ""))
-             #t)))))
+     `(#:configure-flags
+       ;; C++11 (-DSOCI_CXX11) is OFF by default.  hyperledger-iroha needs it.
+       (list "-DCMAKE_CXX_STANDARD=17"
+             "-DSOCI_LIBDIR=lib")
+       #:tests? #f))         ; may require running database management systems
     (synopsis "C++ Database Access Library")
     (description
      "SOCI is an abstraction layer for several database backends, including
 PostreSQL, SQLite, ODBC and MySQL.")
     (home-page "http://soci.sourceforge.net/")
     (license license:boost1.0)))
+
+(define-public freetds
+  (package
+    (name "freetds")
+    (version "1.2.20")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://www.freetds.org/files/stable/"
+                           "freetds-" version ".tar.gz"))
+       (sha256
+        (base32 "11fzwcahc1bc8npxbif0448v9cwyf7k04167i7fcspmfw7a0hj0d"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; NOTE: (Sharlatan-20210110213908+0000) some tests require DB connection,
+     ;; disabled for now.
+     `(#:tests? #f))
+    (home-page "https://www.freetds.org/")
+    (synopsis "Client libraries for MS SQL and Sybase servers")
+    (description
+     "FreeTDS is an implementation of the Tabular DataStream protocol, used for
+connecting to MS SQL and Sybase servers over TCP/IP.")
+    (license license:lgpl2.0+)))