\

apsw: Another Python SQLite Wrapper

47 points - today at 4:58 PM

Source
  • Retr0id

    today at 6:57 PM

    In a sentence, I'd say apsw is "the SQLite lover's SQLite library". The python stdlib one tries to provide a generic interface ("DBAPI") which is great if you want to be able to swap to a different database engine later, but it's bad for actually getting the most out of SQLite.

      • overflowy

        today at 7:58 PM

        Why do you say it's bad?

          • Retr0id

            today at 8:26 PM

            Everything to do with transactions, including nested transactions.

    • jph00

      today at 9:49 PM

      For anyone interested in an ergonomic API over this-- I ported sqlite-utils to apsw a while back: https://github.com/AnswerDotAI/apswutils

      I've been using it a lot over the last year or two and it's worked great.

      • arc-in-space

        today at 6:27 PM

        This library is great, and recently saved a project of mine. Figuring out what was going on with some of python's sqlite3 quirks was too much of a hassle, meanwhile this more or less just worked the way I expected it to. Because of this experience I started defaulting to it over sqlite3 for other projects as well.

        (This documentation page explains the library's intent: https://rogerbinns.github.io/apsw/pysqlite.html)

          • biorach

            today at 6:39 PM

            what quirks did you bump into with sqlite3?

        • dex0shubham

          today at 9:14 PM

          I was experimenting with APSW and I noticed that when a query doesn't return any row, it becomes difficult to get column names from the cursor, is there any recommended way to do this ?

          • mont_tag

            today at 5:57 PM

            Thank you HackerNews. I learned something new and will be using APSW for my next Sqlite project.

            • scosman

              today at 6:02 PM

              It’s a great wrapper, but we should add a year. Not exactly new.

                • Retr0id

                  today at 6:24 PM

                  The latest commit was 1 hour ago

                    • scosman

                      today at 7:16 PM

                      ahh. It’s been around a while, but maybe the date convention is for articles not repos.

                      • arcanemachiner

                        today at 6:52 PM

                        Abandonware!

                    • gjvc

                      today at 8:38 PM

                      new to many people, just not you.