• Stars
    star
    199
  • Rank 196,177 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created over 1 year ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SQLite package manager

The (unofficial) SQLite package manager

sqlpkg manages SQLite extensions, just like pip does with Python packages or brew does with macOS programs.

It works primarily with the SQLite package registry, but is not limited to it. You can install SQLite extensions from GitHub repositories or other websites. All you need is a package spec file (more on that later).

$ sqlpkg help
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ sqlpkg is an SQLite package manager.           โ”‚
โ”‚ Use it to install or update SQLite extensions. โ”‚
โ”‚                                                โ”‚
โ”‚ Commands:                                      โ”‚
โ”‚ help       Display help                        โ”‚
โ”‚ info       Display package information         โ”‚
โ”‚ init       Init project scope                  โ”‚
โ”‚ install    Install packages                    โ”‚
โ”‚ list       List installed packages             โ”‚
โ”‚ uninstall  Uninstall package                   โ”‚
โ”‚ update     Update installed packages           โ”‚
โ”‚ version    Display version                     โ”‚
โ”‚ which      Display path to extension file      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

sqlpkg is implemented in Go and has zero dependencies (see Writing a package manager for details).

Download โ€ข Install packages โ€ข Package location โ€ข Load into SQLite โ€ข Other commands โ€ข Lockfile

Download and install (preferred method)

Linux/macOS:

curl -sS https://webi.sh/sqlpkg | sh

Windows:

curl.exe https://webi.ms/sqlpkg | powershell

To update or switch versions, run webi sqlpkg@stable (or @v1.1, @beta, etc).

Download and install (manual)

sqlpkg is a binary executable file (sqlpkg.exe on Windows, sqlpkg on Linux/macOS). Download it from the link below, unpack and put somewhere in your PATH (what's that?), so you can run it from anyhwere on your computer.

Download

Then run it from the command line (terminal) as described below.

Note for macOS users. macOS disables unsigned binaries and prevents the sqlpkg from running. To resolve this issue, remove the build from quarantine by running the following command in Terminal (replace /path/to/folder with an actual path to the folder containing the sqlpkg binary):

xattr -d com.apple.quarantine /path/to/folder/sqlpkg

Installing packages

Install a package from the registry:

sqlpkg install nalgeon/stats

nalgeon/stats is the ID of the extension as shown in the registry.

Install a package from a GitHub repository (it should have a package spec file):

sqlpkg install github.com/nalgeon/sqlean

Install a package from a spec file somewhere on the Internet:

sqlpkg install https://antonz.org/downloads/stats.json

Install a package from a local spec file:

sqlpkg install ./stats.json

Package location

By default, sqlpkg installs all extensions in the home folder:

  • %USERPROFILE%\.sqlpkg on Windows
  • ~/.sqlpkg on Linux/macOS

For example, given the user anton and the package nalgeon/stats, the location will be:

  • C:\Users\anton\.sqlpkg\nalgeon\stats\stats.dll on Windows
  • /home/anton/.sqlpkg/nalgeon/stats/stats.so on Linux
  • /Users/anton/.sqlpkg/nalgeon/stats/stats.dylib on macOS

This is what it looks like:

sqlpkg install nalgeon/stats
> installing nalgeon/stats...
โœ“ installed package nalgeon/stats to /Users/anton/.sqlpkg/nalgeon/stats
sqlpkg install asg017/hello
> installing asg017/hello...
โœ“ installed package asg017/hello to /Users/anton/.sqlpkg/asg017/hello
.sqlpkg
โ”œโ”€โ”€ asg017
โ”‚ย ย  โ””โ”€โ”€ hello
โ”‚ย ย      โ”œโ”€โ”€ hello0.dylib
โ”‚ย ย      โ”œโ”€โ”€ hola0.dylib
โ”‚ย ย      โ””โ”€โ”€ sqlpkg.json
โ””โ”€โ”€ nalgeon
    โ””โ”€โ”€ stats
        โ”œโ”€โ”€ sqlpkg.json
        โ””โ”€โ”€ stats.dylib

Loading installed extensions in SQLite

To load an extension, you'll need the path to the extension file. Run the which command to see it:

sqlpkg which nalgeon/stats
/Users/anton/.sqlpkg/nalgeon/stats/stats.dylib

Use this path to load the extension with a .load shell command, a load_extension() SQL function, or other means. See this guide for details:

How to Install an SQLite Extension

Other commands

sqlpkg provides other basic commands you would expect from a package manager.

update

sqlpkg update

Updates all installed packages to the latest versions.

uninstall

sqlpkg uninstall nalgeon/stats

Uninstalls a previously installed package.

list

sqlpkg list

Lists installed packages.

info

sqlpkg info nalgeon/stats

Displays package information. Works with both local and remote packages.

version

sqlpkg version

Displays sqlpkg version number.

Project vs. global scope

By default, sqlpkg installs all extensions in the home folder (global scope). If you are writing a Python (JavaScript, Go, ...) application โ€” you may prefer to put them in the project folder (project scope, like virtual environment in Python or node_modules in JavaScript).

To do that, run the init command:

sqlpkg init

It will create an .sqlpkg folder in the current directory. After that, all other commands run from the same directory will use it instead of the home folder.

Package spec file

The package spec file describes a particular package so that sqlpkg can work with it. It is usually created by the package author, so if you are a sqlpkg user, you don't need to worry about that.

If you are a package author, who wants your package to be installable by sqlpkg, learn how to create a spec file.

Lockfile

sqlpkg stores information about the installed packages in a special file (the lockfile) โ€” sqlpkg.lock. If you're using a project scope, it's a good idea to commit sqlpkg.lock along with other code. This way, when you check out the code on another machine, you can install all the packages at once.

To install the packages listed in the lockfile, simply run install with no arguments:

sqlpkg install

sqlpkg will detect the lockfile (in the current folder or the user's home folder) and install all the packages listed in it.

โ”€โ”€

That's all for now. Now try some packages!

โฌ‡๏ธ Download โ€ข โœจ Explore โ€ข ๐Ÿš€ Follow

More Repositories

1

sqlean

The ultimate set of SQLite extensions
C
3,638
star
2

redka

Redis re-implemented with SQLite
Go
3,354
star
3

codapi

Interactive code examples for documentation, education and fun
Go
1,436
star
4

sqlime

Online SQLite playground
JavaScript
890
star
5

codapi-js

Interactive code examples for documentation, education and fun.
JavaScript
478
star
6

dataviz

Data visualization guide for presentations, reports, and dashboards
Python
436
star
7

pokitoki

Humble GPT Telegram Bot
Python
313
star
8

zero

Zero Dependency Club
159
star
9

sqlpkg

SQLite extension registry
132
star
10

iuliia-py

Transliterate Cyrillic โ†’ Latin in every possible way
Python
112
star
11

sqlean.py

Python's sqlite3 + extensions
C
105
star
12

sqlean.js

Browser-based SQLite with extensions
Makefile
86
star
13

iuliia-js

Transliterate Cyrillic โ†’ Latin in every possible way
TypeScript
82
star
14

uuidv7

UUIDv7 in N languages
Racket
79
star
15

podsearch-py

Let's find some podcasts!
Python
72
star
16

iuliia

Transliterate Cyrillic โ†’ Latin in every possible way
69
star
17

sqlite

SQLite / Sqlean shell builds
Makefile
62
star
18

git-by-example

Step-by-step guide to Git operations
47
star
19

whatbrowser

ะ’ัะต, ั‡ั‚ะพ ะฝัƒะถะฝะพ ะทะฝะฐั‚ัŒ ะพ ะฑั€ะฐัƒะทะตั€ะต ะฟะพะปัŒะทะพะฒะฐั‚ะตะปั
JavaScript
43
star
20

tryxinyminutes

Live code tutorials in your browser
Shell
41
star
21

invoice

ะัƒ ะพั‡ะตะฝัŒ ะฟั€ะพัั‚ะพะต ะฒั‹ัั‚ะฐะฒะปะตะฝะธะต ัั‡ะตั‚ะพะฒ ะดะปั ัŽั€ะปะธั†
HTML
39
star
22

words

Word and phrase lists in CSV
Python
30
star
23

grep-by-example

Step-by-step guide to grep operations
28
star
24

metro

Metro lines and stations for cities in Belorussia, Kazakhstan, Russia and Ukraine
14
star
25

runno

Runno WASI runtime.
TypeScript
10
star
26

sqlite-stats

Statistical functions for SQLite
C
9
star
27

sqlite-wasi

SQLite WASI build.
C
9
star
28

metalsmith-typography

A Metalsmith plugin to enhance typography
JavaScript
9
star
29

python-wasi

Python WASI build.
JavaScript
8
star
30

php-wasi

PHP WASI build.
JavaScript
8
star
31

curl-by-example

Step-by-step guide to curl operations
8
star
32

sqliter

SQLite ะฝะฐ ะฟั€ะฐะบั‚ะธะบะต
JavaScript
6
star
33

lua-wasi

Lua WASI build.
C
5
star
34

nalgeon.github.io

Everything about SQLite, Python, open data and awesome software
JavaScript
3
star
35

sqlite-ext

All "miscellaneous" SQLite extensions from sqlite.org
Makefile
3
star
36

asylum

ยซะŸัะธั…ะฑะพะปัŒะฝะธั†ะฐยป ะšัƒะฟะตั€ะฐ 20 ะปะตั‚ ัะฟัƒัั‚ั
CSS
2
star
37

nalgeon

2
star
38

sql-window-functions

SQL Window Functions Explained
2
star
39

inline-css

A native CSS framework for rapid UI development.
HTML
1
star
40

wee

Toy WSGI-compatible web framework
Python
1
star
41

rosenc

HTML
1
star
42

ruby-wasi

Ruby WASI build.
JavaScript
1
star
43

actionist

GitHub Actions Playground
C
1
star