Skip to content

Commit 163a6d8

Browse files
committed
Readme
1 parent 51a593a commit 163a6d8

1 file changed

Lines changed: 143 additions & 2 deletions

File tree

README.md

Lines changed: 143 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,145 @@
1-
# sqlon
1+
# SQLON — SQL Object Notation
22

3-
TODO: Add project description
3+
SQLON (SQL Object Notation) is a strict, SQL-shaped interchange format designed to represent structured data in a relational form. It acts as a **canonical internal representation** that can be compiled into real SQL and converted to and from formats such as JSON, CSV, and XML.
44

5+
## Features
6+
7+
- **Relational-first design** - Mirrors relational database concepts directly
8+
- **Strict schema enforcement** - Explicit types and structure, fails early on malformed input
9+
- **Format conversion** - Convert between JSON, SQL, and SQLON formats
10+
- **Roundtrip testing** - Verify data integrity through format conversions
11+
- **Human-readable** - Designed to be readable and version-control friendly
12+
13+
## Installation
14+
15+
### Build from source
16+
17+
```bash
18+
git clone https://github.com/XanderCalvert/sqlon.git
19+
cd sqlon
20+
go build ./cmd/sqlon
21+
```
22+
23+
This will create a `sqlon` executable (or `sqlon.exe` on Windows).
24+
25+
## Usage
26+
27+
### Convert SQLON to SQL
28+
29+
Convert a SQLON file to SQLite SQL:
30+
31+
```bash
32+
sqlon to-sql example.sqlon
33+
```
34+
35+
This outputs SQLite CREATE TABLE and INSERT statements to stdout.
36+
37+
### Roundtrip Pipeline
38+
39+
Run a complete roundtrip conversion pipeline (JSON → SQLON → SQL → SQLON → JSON):
40+
41+
```bash
42+
sqlon roundtrip input.json
43+
```
44+
45+
This generates files in the `out/` directory:
46+
- `01.sqlon` - Initial SQLON conversion from JSON
47+
- `02.sqlite.sql` - SQLite SQL output
48+
- `03.roundtrip.sqlon` - SQLON after SQL roundtrip
49+
- `04.json.out.json` - Final JSON output
50+
- `pipeline.log.jsonl` - Pipeline execution log
51+
52+
## SQLON Format
53+
54+
A SQLON file contains one or more tables, defined sequentially. Each table consists of:
55+
56+
1. A table declaration (`@table <name>`)
57+
2. Column definitions (`@cols <col1:type1,col2:type2,...>`)
58+
3. Optional primary key (`@pk <column>`)
59+
4. Zero or more data rows (arrays of values)
60+
61+
### Example
62+
63+
```sqlon
64+
@table people
65+
@cols id:int, name:text, active:bool
66+
@pk id
67+
68+
[1,"Matt",true]
69+
[2,"Calvert",false]
70+
```
71+
72+
### Supported Types
73+
74+
- `int` - Integer
75+
- `text` - Text/String
76+
- `bool` - Boolean
77+
- `decimal` - Decimal number
78+
- `datetime` - DateTime
79+
- `null` - Null type
80+
81+
### Comments
82+
83+
SQLON supports both `#` and `--` style comments:
84+
85+
```sqlon
86+
# This is a comment
87+
@table users
88+
@cols id:int, name:text -- Column definitions
89+
@pk id
90+
```
91+
92+
## Examples
93+
94+
See the `examples/` directory for example files:
95+
- `input.json` - Sample JSON input
96+
- `input.sqlon` - SQLON representation
97+
- `input.sqlite.sql` - SQLite SQL output
98+
- `input.roundtrip.sqlon` - SQLON after roundtrip
99+
- `input.out.json` - Final JSON output
100+
101+
## Project Structure
102+
103+
```
104+
sqlon/
105+
├── cmd/sqlon/ # CLI application
106+
├── internal/
107+
│ ├── format/ # Format converters (json, sql, sqlon)
108+
│ ├── model/ # Core data model (Database, Table, Column, Row)
109+
│ ├── pipeline/ # Conversion pipeline
110+
│ └── normalise/ # Normalization utilities
111+
├── examples/ # Example files
112+
└── .github/workflows/ # CI/CD workflows
113+
```
114+
115+
## Design Principles
116+
117+
- **Relational-first** - SQLON mirrors relational database concepts directly
118+
- **Strict, not permissive** - Ambiguous or malformed input must fail early
119+
- **Deterministic** - Identical input always produces identical output
120+
- **Readable and diff-friendly** - Designed for human readability and version control
121+
- **Canonical representation** - SQLON is the internal normalized form
122+
123+
See [SPEC.md](SPEC.md) for the complete specification and [MANIFESTO.md](MANIFESTO.md) for the project philosophy.
124+
125+
## Status
126+
127+
This is an experimental project. Breaking changes are expected. The current MVP supports:
128+
129+
- ✅ SQLON parsing and formatting
130+
- ✅ JSON import/export
131+
- ✅ SQLite SQL export/import
132+
- ✅ Roundtrip pipeline testing
133+
- ✅ GitHub Actions CI/CD
134+
135+
## Related Projects
136+
137+
- [sqlon-vscode](https://github.com/XanderCalvert/sqlon-vscode) - VS Code syntax highlighting extension for SQLON
138+
139+
## License
140+
141+
[Add your license here]
142+
143+
## Contributing
144+
145+
Contributions are welcome! This is an exploratory project, so feel free to experiment and propose changes.

0 commit comments

Comments
 (0)