nesql 0.0.1__tar.gz
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.
- nesql-0.0.1/LICENSE +151 -0
- nesql-0.0.1/PKG-INFO +168 -0
- nesql-0.0.1/README.md +147 -0
- nesql-0.0.1/nesql/__init__.py +28 -0
- nesql-0.0.1/nesql.egg-info/PKG-INFO +168 -0
- nesql-0.0.1/nesql.egg-info/SOURCES.txt +8 -0
- nesql-0.0.1/nesql.egg-info/dependency_links.txt +1 -0
- nesql-0.0.1/nesql.egg-info/top_level.txt +1 -0
- nesql-0.0.1/pyproject.toml +29 -0
- nesql-0.0.1/setup.cfg +4 -0
nesql-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
5
|
+
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: INTERCHAINED LLC
|
|
11
|
+
|
|
12
|
+
Licensed Work: NEDB, version 4.0.0 and later.
|
|
13
|
+
The Licensed Work is (c) 2026 INTERCHAINED LLC.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: You may make production use of the Licensed Work,
|
|
16
|
+
without limitation and without obtaining any further
|
|
17
|
+
permission or license from the Licensor, provided that
|
|
18
|
+
your Annual Revenue is less than one million United
|
|
19
|
+
States dollars (USD $1,000,000).
|
|
20
|
+
|
|
21
|
+
"Annual Revenue" means the total gross revenue,
|
|
22
|
+
recognised under the accounting standards you ordinarily
|
|
23
|
+
apply, of you together with all of your Affiliates, over
|
|
24
|
+
your most recently completed fiscal year. "Affiliates"
|
|
25
|
+
means any entity that controls, is controlled by, or is
|
|
26
|
+
under common control with you, where "control" means
|
|
27
|
+
direct or indirect ownership of more than fifty percent
|
|
28
|
+
(50%) of the voting interests of an entity.
|
|
29
|
+
|
|
30
|
+
Annual Revenue is measured on your organisation as a
|
|
31
|
+
whole. It is NOT limited to revenue derived from, or
|
|
32
|
+
attributable to, the Licensed Work. An organisation
|
|
33
|
+
whose Annual Revenue is USD $1,000,000 or more must
|
|
34
|
+
obtain an additional use grant from the Licensor before
|
|
35
|
+
making production use of the Licensed Work.
|
|
36
|
+
|
|
37
|
+
Regardless of Annual Revenue, this Additional Use Grant
|
|
38
|
+
does not permit you to offer the Licensed Work, or a
|
|
39
|
+
substantially similar derivative of it, to third parties
|
|
40
|
+
as a managed, hosted or database-as-a-service offering.
|
|
41
|
+
That use requires a separate commercial license.
|
|
42
|
+
|
|
43
|
+
Non-production use is always permitted: development,
|
|
44
|
+
testing, continuous integration, evaluation, research,
|
|
45
|
+
teaching and personal projects are unrestricted for
|
|
46
|
+
everyone, at any revenue.
|
|
47
|
+
|
|
48
|
+
To obtain an additional use grant, contact
|
|
49
|
+
licensing@interchained.org.
|
|
50
|
+
|
|
51
|
+
Change Date: 2030-09-11
|
|
52
|
+
|
|
53
|
+
Change License: Apache License, Version 2.0
|
|
54
|
+
The full text ships in this repository as
|
|
55
|
+
COPYING-APACHE-2.0.txt, so the grant is verifiable from
|
|
56
|
+
the source tree alone.
|
|
57
|
+
|
|
58
|
+
The Change License relicenses the Licensed Work's OWN
|
|
59
|
+
source. It does not relicense third-party dependencies,
|
|
60
|
+
which keep their own terms — inventoried in
|
|
61
|
+
THIRD_PARTY.md.
|
|
62
|
+
|
|
63
|
+
-----------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
Terms
|
|
66
|
+
|
|
67
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
68
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
69
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
70
|
+
production use.
|
|
71
|
+
|
|
72
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
73
|
+
available distribution of a specific version of the Licensed Work under this
|
|
74
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
75
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
76
|
+
above terminate.
|
|
77
|
+
|
|
78
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
79
|
+
currently in effect as described in this License, you must purchase a
|
|
80
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
81
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
82
|
+
|
|
83
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
84
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
85
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
86
|
+
for each version of the Licensed Work released by Licensor.
|
|
87
|
+
|
|
88
|
+
You must conspicuously display this License on each original or modified copy
|
|
89
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
90
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
91
|
+
License apply to your use of that work.
|
|
92
|
+
|
|
93
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
94
|
+
terminate your rights under this License for the current and all other
|
|
95
|
+
versions of the Licensed Work.
|
|
96
|
+
|
|
97
|
+
This License does not grant you any right in any trademark or logo of
|
|
98
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
99
|
+
Licensor as expressly required by this License).
|
|
100
|
+
|
|
101
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
102
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
103
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
104
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
105
|
+
TITLE.
|
|
106
|
+
|
|
107
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
108
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
109
|
+
as long as you comply with the Covenants of Licensor below.
|
|
110
|
+
|
|
111
|
+
-----------------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
Covenants of Licensor
|
|
114
|
+
|
|
115
|
+
In consideration of the right to use this License's text and the "Business
|
|
116
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
117
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
118
|
+
|
|
119
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
120
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
121
|
+
where "compatible" means that software provided under the Change License
|
|
122
|
+
can be included in a program with software provided under GPL Version 2.0
|
|
123
|
+
or a later version. Licensor may specify additional Change Licenses
|
|
124
|
+
without limitation.
|
|
125
|
+
|
|
126
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
127
|
+
impose any additional restriction on the right granted in this License, as
|
|
128
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
129
|
+
|
|
130
|
+
3. To specify a Change Date.
|
|
131
|
+
|
|
132
|
+
4. Not to modify this License in any other way.
|
|
133
|
+
|
|
134
|
+
-----------------------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
Notice
|
|
137
|
+
|
|
138
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
139
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
140
|
+
under an Open Source License, as stated in this License.
|
|
141
|
+
|
|
142
|
+
-----------------------------------------------------------------------------
|
|
143
|
+
|
|
144
|
+
Prior versions
|
|
145
|
+
|
|
146
|
+
NEDB versions 3.0.0 through 3.3.1 were released under the MIT License. That
|
|
147
|
+
grant is irrevocable for those versions: if you obtained NEDB at 3.3.1 or
|
|
148
|
+
earlier, your rights in that copy are unchanged by this License and are not
|
|
149
|
+
affected by it. This License governs version 4.0.0 and later only.
|
|
150
|
+
|
|
151
|
+
© 2026 INTERCHAINED LLC
|
nesql-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nesql
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: PostgreSQL's grammar, NEDB's memory — SQL with time travel, bi-temporal validity and causal provenance. Pre-release: name reserved, grammar vendored.
|
|
5
|
+
Author-email: Interchained LLC <licensing@interchained.org>
|
|
6
|
+
License: BUSL-1.1
|
|
7
|
+
Project-URL: Homepage, https://github.com/Eth-Interchained/neSQL
|
|
8
|
+
Project-URL: Repository, https://github.com/Eth-Interchained/neSQL
|
|
9
|
+
Project-URL: Engine, https://github.com/Eth-Interchained/nedb
|
|
10
|
+
Keywords: sql,postgresql,database,temporal,time-travel,nedb,nesql
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Database
|
|
16
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
<div align="center">
|
|
23
|
+
|
|
24
|
+
# neSQL
|
|
25
|
+
|
|
26
|
+
**PostgreSQL's grammar. NEDB's memory.**
|
|
27
|
+
|
|
28
|
+
*The SQL you already write — over a database that never forgets, and can prove it.*
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/nesql/)
|
|
31
|
+
[](https://www.npmjs.com/package/nesql)
|
|
32
|
+
[](https://crates.io/crates/nesql)
|
|
33
|
+
[](https://github.com/Eth-Interchained/neSQL)
|
|
34
|
+
[](vendor/postgresql/COPYRIGHT)
|
|
35
|
+
|
|
36
|
+
**[nedb-engine](https://github.com/Eth-Interchained/nedb)** · **[Studio](https://studio.interchained.org)**
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Nobody should have to learn a query language to use a database
|
|
43
|
+
|
|
44
|
+
That sentence cost us a query language.
|
|
45
|
+
|
|
46
|
+
NEDB shipped with **NQL** — a FROM-first language built around the things NEDB can do that
|
|
47
|
+
nothing else can: reach any point in history, ask what was *believed true* as of a date,
|
|
48
|
+
walk the causal chain that produced a record. It works. It is also a tax: before you can
|
|
49
|
+
ask NEDB a question, you have to learn how to ask.
|
|
50
|
+
|
|
51
|
+
Meanwhile the engine grew a PostgreSQL wire-protocol endpoint, and the SQL arriving on it
|
|
52
|
+
was translated into NQL by **string surgery**. That is where every interesting bug lived.
|
|
53
|
+
A qualified column (`WHERE orders.status = 'paid'`) was rewritten by hand and silently
|
|
54
|
+
matched nothing. `HAVING n > 1` passed through verbatim and answered zero rows. `total * 2`
|
|
55
|
+
became a *field name* nothing was called, so the column came back blank. Not one of those
|
|
56
|
+
was an engine bug. Every one was a translation bug.
|
|
57
|
+
|
|
58
|
+
And translation had a ceiling it could never clear. NQL's grouped row carries the group key,
|
|
59
|
+
`count`, and exactly **one** named aggregate — so `SELECT sum(total), avg(total) GROUP BY status`
|
|
60
|
+
was not slow or degraded, it was *unrepresentable*. No amount of cleverness in the translator
|
|
61
|
+
fixes a row model.
|
|
62
|
+
|
|
63
|
+
**So we stopped translating.**
|
|
64
|
+
|
|
65
|
+
## What neSQL is
|
|
66
|
+
|
|
67
|
+
PostgreSQL's real grammar — `gram.y`, all 19,513 lines and 492 keywords of it, vendored from
|
|
68
|
+
**PostgreSQL 17.4** with its copyright notice intact — extended with the handful of clauses
|
|
69
|
+
NEDB needs to say what it can actually do.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
vendor/postgresql/
|
|
73
|
+
gram.y 19,513 lines the real parser, unmodified upstream
|
|
74
|
+
kwlist.h 492 keywords
|
|
75
|
+
system_views.sql 1,377 lines pg_catalog, Postgres's own definitions
|
|
76
|
+
information_schema.sql 3,046 lines the standard catalogue, verbatim
|
|
77
|
+
COPYRIGHT 23 lines permissive; modification expressly granted
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
We are not reimplementing SQL from memory. We are starting from the definition every
|
|
81
|
+
other tool in the world was built against, and adding to it — the same road
|
|
82
|
+
CockroachDB, Materialize and RisingWave all took.
|
|
83
|
+
|
|
84
|
+
### The clauses we add, and why
|
|
85
|
+
|
|
86
|
+
PostgreSQL's grammar contains **no** temporal SQL — we checked, and `SYSTEM_TIME`,
|
|
87
|
+
`PERIOD` and `PORTION` appear exactly zero times in `gram.y`. Time travel was never
|
|
88
|
+
going to arrive for free. So it arrives deliberately:
|
|
89
|
+
|
|
90
|
+
| neSQL | what it answers | precedent |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `AS OF SYSTEM TIME <seq>` | the exact state at a point in history | CockroachDB |
|
|
93
|
+
| `VALID AS OF <time>` | what was *believed true* as of then | SQL:2011 application time |
|
|
94
|
+
| `TRACE <id>` | the causal chain that produced this record | `WITH RECURSIVE` |
|
|
95
|
+
| `LINK` / `TRAVERSE` | relationships, without a join table | graph SQL |
|
|
96
|
+
| `SEARCH` | full-text over document fields | `tsquery` |
|
|
97
|
+
| `_hash` `_seq` `_caused_by` | provenance, selectable like any column | — |
|
|
98
|
+
|
|
99
|
+
And what the vendored grammar hands us for free, which the old translator refused
|
|
100
|
+
by name: `WITH RECURSIVE`, window functions, `GROUPING SETS`, and `MERGE` — upsert,
|
|
101
|
+
which lands remarkably naturally on an append-only store.
|
|
102
|
+
|
|
103
|
+
## What this means if you already speak Postgres
|
|
104
|
+
|
|
105
|
+
You are done learning.
|
|
106
|
+
|
|
107
|
+
```sql
|
|
108
|
+
-- ordinary SQL. nothing to look up.
|
|
109
|
+
SELECT status, sum(total), avg(total)
|
|
110
|
+
FROM orders
|
|
111
|
+
WHERE region = 'eu'
|
|
112
|
+
GROUP BY status
|
|
113
|
+
HAVING count(*) > 1;
|
|
114
|
+
|
|
115
|
+
-- the same query, ninety thousand writes ago
|
|
116
|
+
SELECT status, sum(total), avg(total)
|
|
117
|
+
FROM orders AS OF SYSTEM TIME 412
|
|
118
|
+
GROUP BY status;
|
|
119
|
+
|
|
120
|
+
-- why does this row say what it says?
|
|
121
|
+
TRACE 'order-8814';
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The first query is the point. It is not a NEDB query. It is a query — and the audit
|
|
125
|
+
trail underneath it is free, permanent, and hash-verified, with no triggers, no shadow
|
|
126
|
+
tables, and no application code.
|
|
127
|
+
|
|
128
|
+
## Status: pre-release, and honest about it
|
|
129
|
+
|
|
130
|
+
This repository is the **grammar and the front-end**, being built in the open. It is
|
|
131
|
+
not installable yet, and the package on each registry is a reserved name, not a
|
|
132
|
+
product. When that changes it will change here first.
|
|
133
|
+
|
|
134
|
+
| | |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| ✅ | PostgreSQL 17.4 grammar + catalogue vendored, licence intact |
|
|
137
|
+
| ✅ | Executor foundations shipped in nedb-engine — joins, subqueries, set operations, `array_agg(x ORDER BY y)`, derived tables, `generate_series` |
|
|
138
|
+
| 🔨 | neSQL grammar delta — the temporal and causal clauses above |
|
|
139
|
+
| 🔨 | One IR: neSQL and NQL compiling to the same plan, so nothing translates |
|
|
140
|
+
| 🔨 | The executor pointed at user collections, not only the catalogue |
|
|
141
|
+
| 📋 | Cross-front-end parity assertions — the same question through both, same answer |
|
|
142
|
+
|
|
143
|
+
**Today, right now, in production:** the PostgreSQL endpoint in
|
|
144
|
+
[`nedb-engine`](https://github.com/Eth-Interchained/nedb) already answers `psql`,
|
|
145
|
+
SQLAlchemy (Core *and* ORM), asyncpg and node-postgres against a live store, with
|
|
146
|
+
`pg_catalog` and `information_schema` implemented as genuinely queryable relations.
|
|
147
|
+
neSQL is where that stops needing an asterisk.
|
|
148
|
+
|
|
149
|
+
## Licence
|
|
150
|
+
|
|
151
|
+
neSQL is **BUSL-1.1** — free in production under USD $1M annual revenue, converting
|
|
152
|
+
to Apache 2.0 automatically. See [`LICENSE`](LICENSE).
|
|
153
|
+
|
|
154
|
+
The vendored PostgreSQL sources under `vendor/postgresql/` remain under the
|
|
155
|
+
**PostgreSQL Licence**, reproduced verbatim and unmodified at
|
|
156
|
+
[`vendor/postgresql/COPYRIGHT`](vendor/postgresql/COPYRIGHT). Our thanks to the
|
|
157
|
+
PostgreSQL Global Development Group — thirty years of grammar we did not have to
|
|
158
|
+
guess at.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
<div align="center">
|
|
163
|
+
|
|
164
|
+
**© INTERCHAINED LLC** · built with **Vex** (Claude Opus 5)
|
|
165
|
+
|
|
166
|
+
*Interchained builds tools that outlive the demo.*
|
|
167
|
+
|
|
168
|
+
</div>
|
nesql-0.0.1/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# neSQL
|
|
4
|
+
|
|
5
|
+
**PostgreSQL's grammar. NEDB's memory.**
|
|
6
|
+
|
|
7
|
+
*The SQL you already write — over a database that never forgets, and can prove it.*
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/nesql/)
|
|
10
|
+
[](https://www.npmjs.com/package/nesql)
|
|
11
|
+
[](https://crates.io/crates/nesql)
|
|
12
|
+
[](https://github.com/Eth-Interchained/neSQL)
|
|
13
|
+
[](vendor/postgresql/COPYRIGHT)
|
|
14
|
+
|
|
15
|
+
**[nedb-engine](https://github.com/Eth-Interchained/nedb)** · **[Studio](https://studio.interchained.org)**
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Nobody should have to learn a query language to use a database
|
|
22
|
+
|
|
23
|
+
That sentence cost us a query language.
|
|
24
|
+
|
|
25
|
+
NEDB shipped with **NQL** — a FROM-first language built around the things NEDB can do that
|
|
26
|
+
nothing else can: reach any point in history, ask what was *believed true* as of a date,
|
|
27
|
+
walk the causal chain that produced a record. It works. It is also a tax: before you can
|
|
28
|
+
ask NEDB a question, you have to learn how to ask.
|
|
29
|
+
|
|
30
|
+
Meanwhile the engine grew a PostgreSQL wire-protocol endpoint, and the SQL arriving on it
|
|
31
|
+
was translated into NQL by **string surgery**. That is where every interesting bug lived.
|
|
32
|
+
A qualified column (`WHERE orders.status = 'paid'`) was rewritten by hand and silently
|
|
33
|
+
matched nothing. `HAVING n > 1` passed through verbatim and answered zero rows. `total * 2`
|
|
34
|
+
became a *field name* nothing was called, so the column came back blank. Not one of those
|
|
35
|
+
was an engine bug. Every one was a translation bug.
|
|
36
|
+
|
|
37
|
+
And translation had a ceiling it could never clear. NQL's grouped row carries the group key,
|
|
38
|
+
`count`, and exactly **one** named aggregate — so `SELECT sum(total), avg(total) GROUP BY status`
|
|
39
|
+
was not slow or degraded, it was *unrepresentable*. No amount of cleverness in the translator
|
|
40
|
+
fixes a row model.
|
|
41
|
+
|
|
42
|
+
**So we stopped translating.**
|
|
43
|
+
|
|
44
|
+
## What neSQL is
|
|
45
|
+
|
|
46
|
+
PostgreSQL's real grammar — `gram.y`, all 19,513 lines and 492 keywords of it, vendored from
|
|
47
|
+
**PostgreSQL 17.4** with its copyright notice intact — extended with the handful of clauses
|
|
48
|
+
NEDB needs to say what it can actually do.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
vendor/postgresql/
|
|
52
|
+
gram.y 19,513 lines the real parser, unmodified upstream
|
|
53
|
+
kwlist.h 492 keywords
|
|
54
|
+
system_views.sql 1,377 lines pg_catalog, Postgres's own definitions
|
|
55
|
+
information_schema.sql 3,046 lines the standard catalogue, verbatim
|
|
56
|
+
COPYRIGHT 23 lines permissive; modification expressly granted
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
We are not reimplementing SQL from memory. We are starting from the definition every
|
|
60
|
+
other tool in the world was built against, and adding to it — the same road
|
|
61
|
+
CockroachDB, Materialize and RisingWave all took.
|
|
62
|
+
|
|
63
|
+
### The clauses we add, and why
|
|
64
|
+
|
|
65
|
+
PostgreSQL's grammar contains **no** temporal SQL — we checked, and `SYSTEM_TIME`,
|
|
66
|
+
`PERIOD` and `PORTION` appear exactly zero times in `gram.y`. Time travel was never
|
|
67
|
+
going to arrive for free. So it arrives deliberately:
|
|
68
|
+
|
|
69
|
+
| neSQL | what it answers | precedent |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `AS OF SYSTEM TIME <seq>` | the exact state at a point in history | CockroachDB |
|
|
72
|
+
| `VALID AS OF <time>` | what was *believed true* as of then | SQL:2011 application time |
|
|
73
|
+
| `TRACE <id>` | the causal chain that produced this record | `WITH RECURSIVE` |
|
|
74
|
+
| `LINK` / `TRAVERSE` | relationships, without a join table | graph SQL |
|
|
75
|
+
| `SEARCH` | full-text over document fields | `tsquery` |
|
|
76
|
+
| `_hash` `_seq` `_caused_by` | provenance, selectable like any column | — |
|
|
77
|
+
|
|
78
|
+
And what the vendored grammar hands us for free, which the old translator refused
|
|
79
|
+
by name: `WITH RECURSIVE`, window functions, `GROUPING SETS`, and `MERGE` — upsert,
|
|
80
|
+
which lands remarkably naturally on an append-only store.
|
|
81
|
+
|
|
82
|
+
## What this means if you already speak Postgres
|
|
83
|
+
|
|
84
|
+
You are done learning.
|
|
85
|
+
|
|
86
|
+
```sql
|
|
87
|
+
-- ordinary SQL. nothing to look up.
|
|
88
|
+
SELECT status, sum(total), avg(total)
|
|
89
|
+
FROM orders
|
|
90
|
+
WHERE region = 'eu'
|
|
91
|
+
GROUP BY status
|
|
92
|
+
HAVING count(*) > 1;
|
|
93
|
+
|
|
94
|
+
-- the same query, ninety thousand writes ago
|
|
95
|
+
SELECT status, sum(total), avg(total)
|
|
96
|
+
FROM orders AS OF SYSTEM TIME 412
|
|
97
|
+
GROUP BY status;
|
|
98
|
+
|
|
99
|
+
-- why does this row say what it says?
|
|
100
|
+
TRACE 'order-8814';
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The first query is the point. It is not a NEDB query. It is a query — and the audit
|
|
104
|
+
trail underneath it is free, permanent, and hash-verified, with no triggers, no shadow
|
|
105
|
+
tables, and no application code.
|
|
106
|
+
|
|
107
|
+
## Status: pre-release, and honest about it
|
|
108
|
+
|
|
109
|
+
This repository is the **grammar and the front-end**, being built in the open. It is
|
|
110
|
+
not installable yet, and the package on each registry is a reserved name, not a
|
|
111
|
+
product. When that changes it will change here first.
|
|
112
|
+
|
|
113
|
+
| | |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| ✅ | PostgreSQL 17.4 grammar + catalogue vendored, licence intact |
|
|
116
|
+
| ✅ | Executor foundations shipped in nedb-engine — joins, subqueries, set operations, `array_agg(x ORDER BY y)`, derived tables, `generate_series` |
|
|
117
|
+
| 🔨 | neSQL grammar delta — the temporal and causal clauses above |
|
|
118
|
+
| 🔨 | One IR: neSQL and NQL compiling to the same plan, so nothing translates |
|
|
119
|
+
| 🔨 | The executor pointed at user collections, not only the catalogue |
|
|
120
|
+
| 📋 | Cross-front-end parity assertions — the same question through both, same answer |
|
|
121
|
+
|
|
122
|
+
**Today, right now, in production:** the PostgreSQL endpoint in
|
|
123
|
+
[`nedb-engine`](https://github.com/Eth-Interchained/nedb) already answers `psql`,
|
|
124
|
+
SQLAlchemy (Core *and* ORM), asyncpg and node-postgres against a live store, with
|
|
125
|
+
`pg_catalog` and `information_schema` implemented as genuinely queryable relations.
|
|
126
|
+
neSQL is where that stops needing an asterisk.
|
|
127
|
+
|
|
128
|
+
## Licence
|
|
129
|
+
|
|
130
|
+
neSQL is **BUSL-1.1** — free in production under USD $1M annual revenue, converting
|
|
131
|
+
to Apache 2.0 automatically. See [`LICENSE`](LICENSE).
|
|
132
|
+
|
|
133
|
+
The vendored PostgreSQL sources under `vendor/postgresql/` remain under the
|
|
134
|
+
**PostgreSQL Licence**, reproduced verbatim and unmodified at
|
|
135
|
+
[`vendor/postgresql/COPYRIGHT`](vendor/postgresql/COPYRIGHT). Our thanks to the
|
|
136
|
+
PostgreSQL Global Development Group — thirty years of grammar we did not have to
|
|
137
|
+
guess at.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
<div align="center">
|
|
142
|
+
|
|
143
|
+
**© INTERCHAINED LLC** · built with **Vex** (Claude Opus 5)
|
|
144
|
+
|
|
145
|
+
*Interchained builds tools that outlive the demo.*
|
|
146
|
+
|
|
147
|
+
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 INTERCHAINED LLC
|
|
2
|
+
# SPDX-License-Identifier: BUSL-1.1
|
|
3
|
+
# neSQL · © 2026 INTERCHAINED LLC × Eth-Interchained × Vex (Claude Opus 5)
|
|
4
|
+
"""neSQL — PostgreSQL's grammar, NEDB's memory.
|
|
5
|
+
|
|
6
|
+
This package is a reserved name and a statement of intent, and it reports that
|
|
7
|
+
rather than pretending to be a driver. The working PostgreSQL wire endpoint
|
|
8
|
+
ships TODAY in nedb-engine::
|
|
9
|
+
|
|
10
|
+
nedbd --pg-port 5433
|
|
11
|
+
|
|
12
|
+
answered by psycopg2, SQLAlchemy (Core and ORM), asyncpg and node-postgres
|
|
13
|
+
against a live, tamper-evident store.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
#: The PostgreSQL release this package's vendored grammar is taken from.
|
|
17
|
+
VENDORED_POSTGRES = "17.4"
|
|
18
|
+
__version__ = "0.0.1"
|
|
19
|
+
#: Where the working PostgreSQL wire endpoint lives today.
|
|
20
|
+
ENGINE = "https://github.com/Eth-Interchained/nedb"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def is_release() -> bool:
|
|
24
|
+
"""Is this a usable query engine yet? No -- and it says so rather than pretending."""
|
|
25
|
+
return False
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
__all__ = ["VENDORED_POSTGRES", "__version__", "ENGINE", "is_release"]
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nesql
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: PostgreSQL's grammar, NEDB's memory — SQL with time travel, bi-temporal validity and causal provenance. Pre-release: name reserved, grammar vendored.
|
|
5
|
+
Author-email: Interchained LLC <licensing@interchained.org>
|
|
6
|
+
License: BUSL-1.1
|
|
7
|
+
Project-URL: Homepage, https://github.com/Eth-Interchained/neSQL
|
|
8
|
+
Project-URL: Repository, https://github.com/Eth-Interchained/neSQL
|
|
9
|
+
Project-URL: Engine, https://github.com/Eth-Interchained/nedb
|
|
10
|
+
Keywords: sql,postgresql,database,temporal,time-travel,nedb,nesql
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Database
|
|
16
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
<div align="center">
|
|
23
|
+
|
|
24
|
+
# neSQL
|
|
25
|
+
|
|
26
|
+
**PostgreSQL's grammar. NEDB's memory.**
|
|
27
|
+
|
|
28
|
+
*The SQL you already write — over a database that never forgets, and can prove it.*
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/nesql/)
|
|
31
|
+
[](https://www.npmjs.com/package/nesql)
|
|
32
|
+
[](https://crates.io/crates/nesql)
|
|
33
|
+
[](https://github.com/Eth-Interchained/neSQL)
|
|
34
|
+
[](vendor/postgresql/COPYRIGHT)
|
|
35
|
+
|
|
36
|
+
**[nedb-engine](https://github.com/Eth-Interchained/nedb)** · **[Studio](https://studio.interchained.org)**
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Nobody should have to learn a query language to use a database
|
|
43
|
+
|
|
44
|
+
That sentence cost us a query language.
|
|
45
|
+
|
|
46
|
+
NEDB shipped with **NQL** — a FROM-first language built around the things NEDB can do that
|
|
47
|
+
nothing else can: reach any point in history, ask what was *believed true* as of a date,
|
|
48
|
+
walk the causal chain that produced a record. It works. It is also a tax: before you can
|
|
49
|
+
ask NEDB a question, you have to learn how to ask.
|
|
50
|
+
|
|
51
|
+
Meanwhile the engine grew a PostgreSQL wire-protocol endpoint, and the SQL arriving on it
|
|
52
|
+
was translated into NQL by **string surgery**. That is where every interesting bug lived.
|
|
53
|
+
A qualified column (`WHERE orders.status = 'paid'`) was rewritten by hand and silently
|
|
54
|
+
matched nothing. `HAVING n > 1` passed through verbatim and answered zero rows. `total * 2`
|
|
55
|
+
became a *field name* nothing was called, so the column came back blank. Not one of those
|
|
56
|
+
was an engine bug. Every one was a translation bug.
|
|
57
|
+
|
|
58
|
+
And translation had a ceiling it could never clear. NQL's grouped row carries the group key,
|
|
59
|
+
`count`, and exactly **one** named aggregate — so `SELECT sum(total), avg(total) GROUP BY status`
|
|
60
|
+
was not slow or degraded, it was *unrepresentable*. No amount of cleverness in the translator
|
|
61
|
+
fixes a row model.
|
|
62
|
+
|
|
63
|
+
**So we stopped translating.**
|
|
64
|
+
|
|
65
|
+
## What neSQL is
|
|
66
|
+
|
|
67
|
+
PostgreSQL's real grammar — `gram.y`, all 19,513 lines and 492 keywords of it, vendored from
|
|
68
|
+
**PostgreSQL 17.4** with its copyright notice intact — extended with the handful of clauses
|
|
69
|
+
NEDB needs to say what it can actually do.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
vendor/postgresql/
|
|
73
|
+
gram.y 19,513 lines the real parser, unmodified upstream
|
|
74
|
+
kwlist.h 492 keywords
|
|
75
|
+
system_views.sql 1,377 lines pg_catalog, Postgres's own definitions
|
|
76
|
+
information_schema.sql 3,046 lines the standard catalogue, verbatim
|
|
77
|
+
COPYRIGHT 23 lines permissive; modification expressly granted
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
We are not reimplementing SQL from memory. We are starting from the definition every
|
|
81
|
+
other tool in the world was built against, and adding to it — the same road
|
|
82
|
+
CockroachDB, Materialize and RisingWave all took.
|
|
83
|
+
|
|
84
|
+
### The clauses we add, and why
|
|
85
|
+
|
|
86
|
+
PostgreSQL's grammar contains **no** temporal SQL — we checked, and `SYSTEM_TIME`,
|
|
87
|
+
`PERIOD` and `PORTION` appear exactly zero times in `gram.y`. Time travel was never
|
|
88
|
+
going to arrive for free. So it arrives deliberately:
|
|
89
|
+
|
|
90
|
+
| neSQL | what it answers | precedent |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `AS OF SYSTEM TIME <seq>` | the exact state at a point in history | CockroachDB |
|
|
93
|
+
| `VALID AS OF <time>` | what was *believed true* as of then | SQL:2011 application time |
|
|
94
|
+
| `TRACE <id>` | the causal chain that produced this record | `WITH RECURSIVE` |
|
|
95
|
+
| `LINK` / `TRAVERSE` | relationships, without a join table | graph SQL |
|
|
96
|
+
| `SEARCH` | full-text over document fields | `tsquery` |
|
|
97
|
+
| `_hash` `_seq` `_caused_by` | provenance, selectable like any column | — |
|
|
98
|
+
|
|
99
|
+
And what the vendored grammar hands us for free, which the old translator refused
|
|
100
|
+
by name: `WITH RECURSIVE`, window functions, `GROUPING SETS`, and `MERGE` — upsert,
|
|
101
|
+
which lands remarkably naturally on an append-only store.
|
|
102
|
+
|
|
103
|
+
## What this means if you already speak Postgres
|
|
104
|
+
|
|
105
|
+
You are done learning.
|
|
106
|
+
|
|
107
|
+
```sql
|
|
108
|
+
-- ordinary SQL. nothing to look up.
|
|
109
|
+
SELECT status, sum(total), avg(total)
|
|
110
|
+
FROM orders
|
|
111
|
+
WHERE region = 'eu'
|
|
112
|
+
GROUP BY status
|
|
113
|
+
HAVING count(*) > 1;
|
|
114
|
+
|
|
115
|
+
-- the same query, ninety thousand writes ago
|
|
116
|
+
SELECT status, sum(total), avg(total)
|
|
117
|
+
FROM orders AS OF SYSTEM TIME 412
|
|
118
|
+
GROUP BY status;
|
|
119
|
+
|
|
120
|
+
-- why does this row say what it says?
|
|
121
|
+
TRACE 'order-8814';
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The first query is the point. It is not a NEDB query. It is a query — and the audit
|
|
125
|
+
trail underneath it is free, permanent, and hash-verified, with no triggers, no shadow
|
|
126
|
+
tables, and no application code.
|
|
127
|
+
|
|
128
|
+
## Status: pre-release, and honest about it
|
|
129
|
+
|
|
130
|
+
This repository is the **grammar and the front-end**, being built in the open. It is
|
|
131
|
+
not installable yet, and the package on each registry is a reserved name, not a
|
|
132
|
+
product. When that changes it will change here first.
|
|
133
|
+
|
|
134
|
+
| | |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| ✅ | PostgreSQL 17.4 grammar + catalogue vendored, licence intact |
|
|
137
|
+
| ✅ | Executor foundations shipped in nedb-engine — joins, subqueries, set operations, `array_agg(x ORDER BY y)`, derived tables, `generate_series` |
|
|
138
|
+
| 🔨 | neSQL grammar delta — the temporal and causal clauses above |
|
|
139
|
+
| 🔨 | One IR: neSQL and NQL compiling to the same plan, so nothing translates |
|
|
140
|
+
| 🔨 | The executor pointed at user collections, not only the catalogue |
|
|
141
|
+
| 📋 | Cross-front-end parity assertions — the same question through both, same answer |
|
|
142
|
+
|
|
143
|
+
**Today, right now, in production:** the PostgreSQL endpoint in
|
|
144
|
+
[`nedb-engine`](https://github.com/Eth-Interchained/nedb) already answers `psql`,
|
|
145
|
+
SQLAlchemy (Core *and* ORM), asyncpg and node-postgres against a live store, with
|
|
146
|
+
`pg_catalog` and `information_schema` implemented as genuinely queryable relations.
|
|
147
|
+
neSQL is where that stops needing an asterisk.
|
|
148
|
+
|
|
149
|
+
## Licence
|
|
150
|
+
|
|
151
|
+
neSQL is **BUSL-1.1** — free in production under USD $1M annual revenue, converting
|
|
152
|
+
to Apache 2.0 automatically. See [`LICENSE`](LICENSE).
|
|
153
|
+
|
|
154
|
+
The vendored PostgreSQL sources under `vendor/postgresql/` remain under the
|
|
155
|
+
**PostgreSQL Licence**, reproduced verbatim and unmodified at
|
|
156
|
+
[`vendor/postgresql/COPYRIGHT`](vendor/postgresql/COPYRIGHT). Our thanks to the
|
|
157
|
+
PostgreSQL Global Development Group — thirty years of grammar we did not have to
|
|
158
|
+
guess at.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
<div align="center">
|
|
163
|
+
|
|
164
|
+
**© INTERCHAINED LLC** · built with **Vex** (Claude Opus 5)
|
|
165
|
+
|
|
166
|
+
*Interchained builds tools that outlive the demo.*
|
|
167
|
+
|
|
168
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nesql
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nesql"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "PostgreSQL's grammar, NEDB's memory — SQL with time travel, bi-temporal validity and causal provenance. Pre-release: name reserved, grammar vendored."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "BUSL-1.1" }
|
|
12
|
+
authors = [{ name = "Interchained LLC", email = "licensing@interchained.org" }]
|
|
13
|
+
keywords = ["sql", "postgresql", "database", "temporal", "time-travel", "nedb", "nesql"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Rust",
|
|
19
|
+
"Topic :: Database",
|
|
20
|
+
"Topic :: Database :: Database Engines/Servers",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/Eth-Interchained/neSQL"
|
|
25
|
+
Repository = "https://github.com/Eth-Interchained/neSQL"
|
|
26
|
+
Engine = "https://github.com/Eth-Interchained/nedb"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools]
|
|
29
|
+
packages = ["nesql"]
|
nesql-0.0.1/setup.cfg
ADDED