rdbr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +155 -0
- data/app/public/application.js +609 -0
- data/app/public/database-diagram.js +602 -0
- data/app/public/styles.css +2141 -0
- data/app/views/data.haml +166 -0
- data/app/views/group.haml +50 -0
- data/app/views/index.haml +108 -0
- data/app/views/layout.haml +59 -0
- data/app/views/record.haml +81 -0
- data/demo/README.md +47 -0
- data/demo/compose.yml +34 -0
- data/demo/seed.rb +270 -0
- data/demo/smoke.rb +13 -0
- data/docs/RELEASING.md +30 -0
- data/docs/VALUE_PRESENTATION.md +54 -0
- data/exe/rdbr +5 -0
- data/lib/rdbr/access/read_only.rb +61 -0
- data/lib/rdbr/access.rb +6 -0
- data/lib/rdbr/browser_launcher.rb +71 -0
- data/lib/rdbr/catalog/connection.rb +68 -0
- data/lib/rdbr/catalog/errors.rb +12 -0
- data/lib/rdbr/catalog/mysql/queries.rb +131 -0
- data/lib/rdbr/catalog/mysql.rb +146 -0
- data/lib/rdbr/catalog/postgresql/queries.rb +171 -0
- data/lib/rdbr/catalog/postgresql.rb +138 -0
- data/lib/rdbr/catalog/reader.rb +30 -0
- data/lib/rdbr/catalog/serializer.rb +24 -0
- data/lib/rdbr/catalog/sqlite.rb +182 -0
- data/lib/rdbr/catalog.rb +20 -0
- data/lib/rdbr/cli.rb +74 -0
- data/lib/rdbr/cli_options.rb +63 -0
- data/lib/rdbr/metadata/column.rb +44 -0
- data/lib/rdbr/metadata/constraints.rb +25 -0
- data/lib/rdbr/metadata/database.rb +37 -0
- data/lib/rdbr/metadata/index.rb +30 -0
- data/lib/rdbr/metadata/keys.rb +56 -0
- data/lib/rdbr/metadata/namespace.rb +26 -0
- data/lib/rdbr/metadata/relation.rb +104 -0
- data/lib/rdbr/metadata/relationship_inference.rb +75 -0
- data/lib/rdbr/metadata/relationships.rb +126 -0
- data/lib/rdbr/metadata/values.rb +73 -0
- data/lib/rdbr/metadata.rb +10 -0
- data/lib/rdbr/presentation/record_identity.rb +125 -0
- data/lib/rdbr/query/connection.rb +138 -0
- data/lib/rdbr/query/errors.rb +33 -0
- data/lib/rdbr/query/lookup.rb +40 -0
- data/lib/rdbr/query/mysql.rb +15 -0
- data/lib/rdbr/query/page.rb +66 -0
- data/lib/rdbr/query/postgresql.rb +7 -0
- data/lib/rdbr/query/postgresql_dialect.rb +11 -0
- data/lib/rdbr/query/relational.rb +239 -0
- data/lib/rdbr/query/sqlite.rb +15 -0
- data/lib/rdbr/query/type_support.rb +68 -0
- data/lib/rdbr/query/value_limiter.rb +38 -0
- data/lib/rdbr/query.rb +32 -0
- data/lib/rdbr/version.rb +3 -0
- data/lib/rdbr/web/application.rb +234 -0
- data/lib/rdbr/web/array_value_helpers.rb +92 -0
- data/lib/rdbr/web/binary_value_helpers.rb +51 -0
- data/lib/rdbr/web/column_preferences.rb +56 -0
- data/lib/rdbr/web/database_graph.rb +91 -0
- data/lib/rdbr/web/deferred_column_value_helpers.rb +20 -0
- data/lib/rdbr/web/deferred_value_helpers.rb +76 -0
- data/lib/rdbr/web/document_value_helpers.rb +68 -0
- data/lib/rdbr/web/filter_presentation_helpers.rb +44 -0
- data/lib/rdbr/web/helpers.rb +42 -0
- data/lib/rdbr/web/identifier_value_helpers.rb +20 -0
- data/lib/rdbr/web/json_page_stream.rb +30 -0
- data/lib/rdbr/web/navigation_helpers.rb +115 -0
- data/lib/rdbr/web/presentation_helpers.rb +114 -0
- data/lib/rdbr/web/range_value_helpers.rb +86 -0
- data/lib/rdbr/web/record_value_helpers.rb +90 -0
- data/lib/rdbr/web/related_value_helpers.rb +99 -0
- data/lib/rdbr/web/relationship_loader.rb +65 -0
- data/lib/rdbr/web/search_value_helpers.rb +58 -0
- data/lib/rdbr/web/spatial_value_helpers.rb +83 -0
- data/lib/rdbr/web/through_relationship_loader.rb +90 -0
- data/lib/rdbr/web/vector_value_helpers.rb +59 -0
- data/lib/rdbr.rb +25 -0
- metadata +298 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 87da572f183e27a7a655a00bfe361c5f41b1c6804839d70937dffbc78f43ecd2
|
|
4
|
+
data.tar.gz: 05bc097aa41fd2fbdd8514013cbcca12c6ee113e1d5aaee98f469ff8710976c5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a0bba4640c5e90eca6058d6213e8c3b95d119992af39d12bee882b7118a38eb0e6a348fee053c8da41effad5d3067dfe75d01caa6f2eb1413678d015564c82ab
|
|
7
|
+
data.tar.gz: 76ff18c1b73aa3036eeda5434ea024c89c96e0f4d363684e019eb06258bc0c4c0eeb56193af5089673d97fb6d7008f1ad3eff8176fc56573fdd94cef8b4d5abd
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
RDBr follows [Semantic Versioning](https://semver.org/). Until version 1.0,
|
|
4
|
+
minor releases may change public interfaces with an accompanying migration note.
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-07-25
|
|
9
|
+
|
|
10
|
+
First public release.
|
|
11
|
+
|
|
12
|
+
- Browse PostgreSQL, SQLite, MySQL, and MariaDB tables and views through a
|
|
13
|
+
standalone, read-only web interface.
|
|
14
|
+
- Inspect table definitions, row counts, keys, relationships, and a searchable,
|
|
15
|
+
interactive database diagram.
|
|
16
|
+
- Search, sort, paginate, filter, and group records, with date-range controls
|
|
17
|
+
and persistent column preferences.
|
|
18
|
+
- Follow declared and confidently inferred relationships, including
|
|
19
|
+
many-to-many associations and their junction records.
|
|
20
|
+
- Navigate records using inferred human-readable identities while preserving
|
|
21
|
+
filters, pagination, and wide-table scroll position.
|
|
22
|
+
- Present JSON, long text, arrays, binary values, identifiers, vectors, spatial
|
|
23
|
+
values, ranges, and other specialised types with suitable viewing and
|
|
24
|
+
clipboard controls.
|
|
25
|
+
- Provide default and dark themes with shared theme-aware components.
|
|
26
|
+
- Protect database access with read-only sessions and requests, bounded query
|
|
27
|
+
time and result sizes, and loopback-only serving by default.
|
|
28
|
+
- Open the browser automatically when the server is ready, with `--no-open` for
|
|
29
|
+
headless and manually managed environments.
|
|
30
|
+
- Include a deterministic online-shop demonstration for SQLite, PostgreSQL, and
|
|
31
|
+
MariaDB.
|
|
32
|
+
- Test supported Ruby and database versions in CI and publish through RubyGems
|
|
33
|
+
trusted publishing.
|
|
34
|
+
|
|
35
|
+
[Unreleased]: https://github.com/andrewtblake/rdbr/compare/v0.1.0...HEAD
|
|
36
|
+
[0.1.0]: https://github.com/andrewtblake/rdbr/releases/tag/v0.1.0
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Blake
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# RDBr
|
|
2
|
+
|
|
3
|
+
RDBr is a read-only relational database browser.
|
|
4
|
+
|
|
5
|
+
Give it a PostgreSQL, SQLite, MySQL, or MariaDB connection and it opens a local
|
|
6
|
+
web interface where you can:
|
|
7
|
+
|
|
8
|
+
- browse tables and views;
|
|
9
|
+
- inspect columns, types, keys, and relationships;
|
|
10
|
+
- search, sort, filter, and paginate records;
|
|
11
|
+
- follow links between associated records;
|
|
12
|
+
- group values and see their counts;
|
|
13
|
+
- view a diagram of the database structure; and
|
|
14
|
+
- inspect JSON, long text, dates, binary data, and other database values.
|
|
15
|
+
|
|
16
|
+
RDBr is useful when you want to explore an unfamiliar database, investigate
|
|
17
|
+
particular records, understand how tables relate, or answer a question without
|
|
18
|
+
writing SQL.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
RDBr requires Ruby 3.2 or newer. Install the gem together with the driver for
|
|
23
|
+
the database you intend to browse:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
gem install rdbr pg # PostgreSQL
|
|
27
|
+
gem install rdbr sqlite3 # SQLite
|
|
28
|
+
gem install rdbr mysql2 # MySQL or MariaDB
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Applications using Bundler can use `bundle add rdbr pg`, replacing `pg` with
|
|
32
|
+
the required driver. Database drivers are optional so installing RDBr does not
|
|
33
|
+
require client libraries for every supported database.
|
|
34
|
+
|
|
35
|
+
The `mysql2` driver requires MySQL or MariaDB client development headers; on
|
|
36
|
+
Debian/Ubuntu these are provided by `libmariadb-dev` or `libmysqlclient-dev`.
|
|
37
|
+
Building `pg` from source may similarly require `libpq-dev`.
|
|
38
|
+
|
|
39
|
+
## Commands
|
|
40
|
+
|
|
41
|
+
Start the browser:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
rdbr serve [--database-url URL] [--host HOST] [--port PORT] [--no-open]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Write a description of the database structure to standard output:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
rdbr inspect [--database-url URL]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Show the installed version:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
rdbr version
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Both `serve` and `inspect` accept `--include-system`. Run `rdbr --help` for the
|
|
60
|
+
complete list of options.
|
|
61
|
+
|
|
62
|
+
## Try the demonstration
|
|
63
|
+
|
|
64
|
+
The included demo is a fictional online shop with customers, addresses,
|
|
65
|
+
products, categories, tags, orders, order items, and shipments. It is ready to
|
|
66
|
+
run with SQLite:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
bundle install
|
|
70
|
+
bundle exec ruby demo/seed.rb
|
|
71
|
+
bundle exec rdbr serve --database-url sqlite3:$(pwd)/tmp/rdbr-demo.sqlite3
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then open <http://127.0.0.1:9292>.
|
|
75
|
+
|
|
76
|
+
The demo can also run on PostgreSQL or MariaDB. See
|
|
77
|
+
[`demo/README.md`](demo/README.md) for those instructions.
|
|
78
|
+
|
|
79
|
+
## Browse a database
|
|
80
|
+
|
|
81
|
+
Prefer the `DATABASE_URL` environment variable so credentials are not placed in
|
|
82
|
+
command history:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
export DATABASE_URL='postgresql://user:password@host/database'
|
|
86
|
+
rdbr serve
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
RDBr opens <http://127.0.0.1:9292> in your default browser when the server is
|
|
90
|
+
ready. Pass `--no-open` when running without a graphical browser or when you
|
|
91
|
+
want to open it yourself.
|
|
92
|
+
|
|
93
|
+
A database URL can instead be supplied directly:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
rdbr serve --database-url postgresql://user:password@host/database
|
|
97
|
+
rdbr serve --database-url sqlite3:/home/user/application.sqlite3
|
|
98
|
+
rdbr serve --database-url mysql2://readonly:password@localhost/application
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Use `inspect` when you want the database structure as JSON rather than the web
|
|
102
|
+
interface:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
rdbr inspect --database-url postgresql://user:password@host/database > catalog.json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
System schemas are hidden by default. Pass `--include-system` if you need to see
|
|
109
|
+
them.
|
|
110
|
+
|
|
111
|
+
## Progressive drill-down
|
|
112
|
+
|
|
113
|
+
You can begin with a whole table and narrow it directly from the records in
|
|
114
|
+
front of you. For example, in the demonstration database you can:
|
|
115
|
+
|
|
116
|
+
- open `products`, click a category, and continue with only products in that
|
|
117
|
+
category;
|
|
118
|
+
- search products for “travel”, sort the matches by price, and group them by
|
|
119
|
+
their `active` value;
|
|
120
|
+
- open a customer, follow the customer's orders, then inspect the individual
|
|
121
|
+
order items and products;
|
|
122
|
+
- open an order item to see the quantity, unit price, and discount recorded on
|
|
123
|
+
the association itself; or
|
|
124
|
+
- open the database diagram, find `orders`, and inspect its columns and links to
|
|
125
|
+
customers, addresses, order items, and shipments.
|
|
126
|
+
|
|
127
|
+
Filters remain visible as you browse and can be removed individually. Following
|
|
128
|
+
a record and returning to its table preserves the list you came from.
|
|
129
|
+
|
|
130
|
+
## Read-only by design
|
|
131
|
+
|
|
132
|
+
RDBr does not provide editing or arbitrary SQL. It rejects write requests and
|
|
133
|
+
uses read-only database sessions where the database supports them. It also
|
|
134
|
+
limits query duration, page size, and the amount returned for an individual
|
|
135
|
+
value.
|
|
136
|
+
|
|
137
|
+
The server listens only on the local computer by default. These safeguards are
|
|
138
|
+
not a substitute for database permissions: use a dedicated account with
|
|
139
|
+
`SELECT` access only, especially for production databases.
|
|
140
|
+
|
|
141
|
+
## Configuration
|
|
142
|
+
|
|
143
|
+
The most commonly useful server options are:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
--statement-timeout MS
|
|
147
|
+
--pool-size COUNT
|
|
148
|
+
--checkout-timeout MS
|
|
149
|
+
--max-value-bytes BYTES
|
|
150
|
+
--max-results COUNT
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
They can also be set with `RDBR_STATEMENT_TIMEOUT`, `RDBR_POOL_SIZE`,
|
|
154
|
+
`RDBR_CHECKOUT_TIMEOUT`, `RDBR_MAX_VALUE_BYTES`, and `RDBR_MAX_RESULTS`.
|
|
155
|
+
Command-line options take precedence over environment variables.
|