• Stars
    star
    199
  • Rank 196,105 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created over 1 year ago
  • Updated 10 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