an5-orm 1.3.2__tar.gz → 1.3.5__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.
- {an5_orm-1.3.2 → an5_orm-1.3.5}/PKG-INFO +75 -12
- {an5_orm-1.3.2 → an5_orm-1.3.5}/README.md +74 -11
- {an5_orm-1.3.2 → an5_orm-1.3.5}/pyproject.toml +1 -1
- {an5_orm-1.3.2 → an5_orm-1.3.5}/python/an5_orm.egg-info/PKG-INFO +75 -12
- {an5_orm-1.3.2 → an5_orm-1.3.5}/python/an5_orm.egg-info/SOURCES.txt +0 -0
- {an5_orm-1.3.2 → an5_orm-1.3.5}/python/an5_orm.egg-info/dependency_links.txt +0 -0
- {an5_orm-1.3.2 → an5_orm-1.3.5}/python/an5_orm.egg-info/requires.txt +0 -0
- {an5_orm-1.3.2 → an5_orm-1.3.5}/python/an5_orm.egg-info/top_level.txt +0 -0
- {an5_orm-1.3.2 → an5_orm-1.3.5}/python/an5_orm.py +0 -0
- {an5_orm-1.3.2 → an5_orm-1.3.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: an5-orm
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.5
|
|
4
4
|
Summary: Lightweight ORM for SQL Server with Python support.
|
|
5
5
|
Author: an5ORM
|
|
6
6
|
License: MIT
|
|
@@ -82,38 +82,58 @@ DATABASE_URL=sqlserver://localhost:1433;database=mydb;user=sa;password=Secret123
|
|
|
82
82
|
|
|
83
83
|
### CLI Commands
|
|
84
84
|
|
|
85
|
+
You can run AN5 commands directly using `npx @an5/orm` (or `npx an5`):
|
|
86
|
+
|
|
85
87
|
```bash
|
|
86
88
|
# Generate client code from .an5 schemas
|
|
87
|
-
|
|
89
|
+
npx @an5/orm generate
|
|
90
|
+
# or: npx an5 generate
|
|
88
91
|
|
|
89
92
|
# Push schema directly to database
|
|
90
|
-
|
|
93
|
+
npx @an5/orm db:push
|
|
91
94
|
|
|
92
95
|
# Pull database schema into .an5 files
|
|
93
|
-
|
|
96
|
+
npx @an5/orm db:pull
|
|
94
97
|
|
|
95
98
|
# Check schema diff
|
|
96
|
-
|
|
99
|
+
npx @an5/orm db:migrate diff
|
|
97
100
|
|
|
98
101
|
# Generate new migration script
|
|
99
|
-
|
|
102
|
+
npx @an5/orm db:migrate generate
|
|
100
103
|
|
|
101
104
|
# Apply pending migrations
|
|
102
|
-
|
|
105
|
+
npx @an5/orm db:migrate apply
|
|
103
106
|
|
|
104
107
|
# Rollback last migration
|
|
105
|
-
|
|
108
|
+
npx @an5/orm db:migrate rollback
|
|
106
109
|
|
|
107
110
|
# View migration status
|
|
108
|
-
|
|
111
|
+
npx @an5/orm db:migrate status
|
|
109
112
|
|
|
110
113
|
# Run database seed script
|
|
111
|
-
|
|
114
|
+
npx @an5/orm db:seed
|
|
112
115
|
|
|
113
|
-
# Clean up
|
|
114
|
-
|
|
116
|
+
# Clean up extra tables and views
|
|
117
|
+
npx @an5/orm db:cleanup
|
|
115
118
|
```
|
|
116
119
|
|
|
120
|
+
You can also add these commands to your project's `package.json` scripts:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"scripts": {
|
|
125
|
+
"generate": "an5 generate",
|
|
126
|
+
"db:push": "an5 db:push",
|
|
127
|
+
"db:pull": "an5 db:pull",
|
|
128
|
+
"db:migrate": "an5 db:migrate",
|
|
129
|
+
"db:seed": "an5 db:seed",
|
|
130
|
+
"db:cleanup": "an5 db:cleanup"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then run them with `npm run generate`, `npm run db:push`, etc.
|
|
136
|
+
|
|
117
137
|
## Runtime Database Usage (via `@an5/adapters`)
|
|
118
138
|
|
|
119
139
|
To connect to your database and perform queries, use `@an5/adapters`:
|
|
@@ -182,6 +202,49 @@ model Order {
|
|
|
182
202
|
}
|
|
183
203
|
```
|
|
184
204
|
|
|
205
|
+
Views are declared with the same field syntax, so generated clients can type their
|
|
206
|
+
rows, plus the `SELECT` that defines them. A view is read-only: writes are not
|
|
207
|
+
generated, and `db:push`/`db:migrate` create the view after the tables it reads —
|
|
208
|
+
and after any view it reads. `db:pull` writes a database view back as a `view`
|
|
209
|
+
block, with its columns and the SQL body from the catalog. `db:cleanup` drops
|
|
210
|
+
views that are no longer in the schema, before the tables they might read.
|
|
211
|
+
|
|
212
|
+
`@@sql` holds the `SELECT` body; a full `CREATE VIEW ... AS ...` statement pasted
|
|
213
|
+
from a catalog is reduced to that body, so its header and object name are not
|
|
214
|
+
repeated in the generated DDL.
|
|
215
|
+
|
|
216
|
+
Generated clients expose a view through a read-only client — `ViewClient` in
|
|
217
|
+
TypeScript, Python, .NET, Java and Kotlin, `ViewModelClient` in Swift, and
|
|
218
|
+
`ViewClient[T]` in Go and Rust. Those types have the read methods only, so a write
|
|
219
|
+
to a view is rejected at compile time rather than by the database.
|
|
220
|
+
|
|
221
|
+
```an5
|
|
222
|
+
view ActiveUser {
|
|
223
|
+
id NVARCHAR(1000)
|
|
224
|
+
email NVARCHAR(255)
|
|
225
|
+
|
|
226
|
+
@@map("active_users")
|
|
227
|
+
@@sql("SELECT id, email FROM users WHERE active = 1")
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
A longer query can be written over several lines with triple quotes; the indentation
|
|
232
|
+
shared by the SQL lines is removed before it reaches the database:
|
|
233
|
+
|
|
234
|
+
```an5
|
|
235
|
+
view ActiveUser {
|
|
236
|
+
id NVARCHAR(1000)
|
|
237
|
+
email NVARCHAR(255)
|
|
238
|
+
|
|
239
|
+
@@map("active_users")
|
|
240
|
+
@@sql("""
|
|
241
|
+
SELECT id, email
|
|
242
|
+
FROM users
|
|
243
|
+
WHERE active = 1
|
|
244
|
+
""")
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
185
248
|
## License
|
|
186
249
|
|
|
187
250
|
MIT
|
|
@@ -69,38 +69,58 @@ DATABASE_URL=sqlserver://localhost:1433;database=mydb;user=sa;password=Secret123
|
|
|
69
69
|
|
|
70
70
|
### CLI Commands
|
|
71
71
|
|
|
72
|
+
You can run AN5 commands directly using `npx @an5/orm` (or `npx an5`):
|
|
73
|
+
|
|
72
74
|
```bash
|
|
73
75
|
# Generate client code from .an5 schemas
|
|
74
|
-
|
|
76
|
+
npx @an5/orm generate
|
|
77
|
+
# or: npx an5 generate
|
|
75
78
|
|
|
76
79
|
# Push schema directly to database
|
|
77
|
-
|
|
80
|
+
npx @an5/orm db:push
|
|
78
81
|
|
|
79
82
|
# Pull database schema into .an5 files
|
|
80
|
-
|
|
83
|
+
npx @an5/orm db:pull
|
|
81
84
|
|
|
82
85
|
# Check schema diff
|
|
83
|
-
|
|
86
|
+
npx @an5/orm db:migrate diff
|
|
84
87
|
|
|
85
88
|
# Generate new migration script
|
|
86
|
-
|
|
89
|
+
npx @an5/orm db:migrate generate
|
|
87
90
|
|
|
88
91
|
# Apply pending migrations
|
|
89
|
-
|
|
92
|
+
npx @an5/orm db:migrate apply
|
|
90
93
|
|
|
91
94
|
# Rollback last migration
|
|
92
|
-
|
|
95
|
+
npx @an5/orm db:migrate rollback
|
|
93
96
|
|
|
94
97
|
# View migration status
|
|
95
|
-
|
|
98
|
+
npx @an5/orm db:migrate status
|
|
96
99
|
|
|
97
100
|
# Run database seed script
|
|
98
|
-
|
|
101
|
+
npx @an5/orm db:seed
|
|
99
102
|
|
|
100
|
-
# Clean up
|
|
101
|
-
|
|
103
|
+
# Clean up extra tables and views
|
|
104
|
+
npx @an5/orm db:cleanup
|
|
102
105
|
```
|
|
103
106
|
|
|
107
|
+
You can also add these commands to your project's `package.json` scripts:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"scripts": {
|
|
112
|
+
"generate": "an5 generate",
|
|
113
|
+
"db:push": "an5 db:push",
|
|
114
|
+
"db:pull": "an5 db:pull",
|
|
115
|
+
"db:migrate": "an5 db:migrate",
|
|
116
|
+
"db:seed": "an5 db:seed",
|
|
117
|
+
"db:cleanup": "an5 db:cleanup"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Then run them with `npm run generate`, `npm run db:push`, etc.
|
|
123
|
+
|
|
104
124
|
## Runtime Database Usage (via `@an5/adapters`)
|
|
105
125
|
|
|
106
126
|
To connect to your database and perform queries, use `@an5/adapters`:
|
|
@@ -169,6 +189,49 @@ model Order {
|
|
|
169
189
|
}
|
|
170
190
|
```
|
|
171
191
|
|
|
192
|
+
Views are declared with the same field syntax, so generated clients can type their
|
|
193
|
+
rows, plus the `SELECT` that defines them. A view is read-only: writes are not
|
|
194
|
+
generated, and `db:push`/`db:migrate` create the view after the tables it reads —
|
|
195
|
+
and after any view it reads. `db:pull` writes a database view back as a `view`
|
|
196
|
+
block, with its columns and the SQL body from the catalog. `db:cleanup` drops
|
|
197
|
+
views that are no longer in the schema, before the tables they might read.
|
|
198
|
+
|
|
199
|
+
`@@sql` holds the `SELECT` body; a full `CREATE VIEW ... AS ...` statement pasted
|
|
200
|
+
from a catalog is reduced to that body, so its header and object name are not
|
|
201
|
+
repeated in the generated DDL.
|
|
202
|
+
|
|
203
|
+
Generated clients expose a view through a read-only client — `ViewClient` in
|
|
204
|
+
TypeScript, Python, .NET, Java and Kotlin, `ViewModelClient` in Swift, and
|
|
205
|
+
`ViewClient[T]` in Go and Rust. Those types have the read methods only, so a write
|
|
206
|
+
to a view is rejected at compile time rather than by the database.
|
|
207
|
+
|
|
208
|
+
```an5
|
|
209
|
+
view ActiveUser {
|
|
210
|
+
id NVARCHAR(1000)
|
|
211
|
+
email NVARCHAR(255)
|
|
212
|
+
|
|
213
|
+
@@map("active_users")
|
|
214
|
+
@@sql("SELECT id, email FROM users WHERE active = 1")
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
A longer query can be written over several lines with triple quotes; the indentation
|
|
219
|
+
shared by the SQL lines is removed before it reaches the database:
|
|
220
|
+
|
|
221
|
+
```an5
|
|
222
|
+
view ActiveUser {
|
|
223
|
+
id NVARCHAR(1000)
|
|
224
|
+
email NVARCHAR(255)
|
|
225
|
+
|
|
226
|
+
@@map("active_users")
|
|
227
|
+
@@sql("""
|
|
228
|
+
SELECT id, email
|
|
229
|
+
FROM users
|
|
230
|
+
WHERE active = 1
|
|
231
|
+
""")
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
172
235
|
## License
|
|
173
236
|
|
|
174
237
|
MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: an5-orm
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.5
|
|
4
4
|
Summary: Lightweight ORM for SQL Server with Python support.
|
|
5
5
|
Author: an5ORM
|
|
6
6
|
License: MIT
|
|
@@ -82,38 +82,58 @@ DATABASE_URL=sqlserver://localhost:1433;database=mydb;user=sa;password=Secret123
|
|
|
82
82
|
|
|
83
83
|
### CLI Commands
|
|
84
84
|
|
|
85
|
+
You can run AN5 commands directly using `npx @an5/orm` (or `npx an5`):
|
|
86
|
+
|
|
85
87
|
```bash
|
|
86
88
|
# Generate client code from .an5 schemas
|
|
87
|
-
|
|
89
|
+
npx @an5/orm generate
|
|
90
|
+
# or: npx an5 generate
|
|
88
91
|
|
|
89
92
|
# Push schema directly to database
|
|
90
|
-
|
|
93
|
+
npx @an5/orm db:push
|
|
91
94
|
|
|
92
95
|
# Pull database schema into .an5 files
|
|
93
|
-
|
|
96
|
+
npx @an5/orm db:pull
|
|
94
97
|
|
|
95
98
|
# Check schema diff
|
|
96
|
-
|
|
99
|
+
npx @an5/orm db:migrate diff
|
|
97
100
|
|
|
98
101
|
# Generate new migration script
|
|
99
|
-
|
|
102
|
+
npx @an5/orm db:migrate generate
|
|
100
103
|
|
|
101
104
|
# Apply pending migrations
|
|
102
|
-
|
|
105
|
+
npx @an5/orm db:migrate apply
|
|
103
106
|
|
|
104
107
|
# Rollback last migration
|
|
105
|
-
|
|
108
|
+
npx @an5/orm db:migrate rollback
|
|
106
109
|
|
|
107
110
|
# View migration status
|
|
108
|
-
|
|
111
|
+
npx @an5/orm db:migrate status
|
|
109
112
|
|
|
110
113
|
# Run database seed script
|
|
111
|
-
|
|
114
|
+
npx @an5/orm db:seed
|
|
112
115
|
|
|
113
|
-
# Clean up
|
|
114
|
-
|
|
116
|
+
# Clean up extra tables and views
|
|
117
|
+
npx @an5/orm db:cleanup
|
|
115
118
|
```
|
|
116
119
|
|
|
120
|
+
You can also add these commands to your project's `package.json` scripts:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"scripts": {
|
|
125
|
+
"generate": "an5 generate",
|
|
126
|
+
"db:push": "an5 db:push",
|
|
127
|
+
"db:pull": "an5 db:pull",
|
|
128
|
+
"db:migrate": "an5 db:migrate",
|
|
129
|
+
"db:seed": "an5 db:seed",
|
|
130
|
+
"db:cleanup": "an5 db:cleanup"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then run them with `npm run generate`, `npm run db:push`, etc.
|
|
136
|
+
|
|
117
137
|
## Runtime Database Usage (via `@an5/adapters`)
|
|
118
138
|
|
|
119
139
|
To connect to your database and perform queries, use `@an5/adapters`:
|
|
@@ -182,6 +202,49 @@ model Order {
|
|
|
182
202
|
}
|
|
183
203
|
```
|
|
184
204
|
|
|
205
|
+
Views are declared with the same field syntax, so generated clients can type their
|
|
206
|
+
rows, plus the `SELECT` that defines them. A view is read-only: writes are not
|
|
207
|
+
generated, and `db:push`/`db:migrate` create the view after the tables it reads —
|
|
208
|
+
and after any view it reads. `db:pull` writes a database view back as a `view`
|
|
209
|
+
block, with its columns and the SQL body from the catalog. `db:cleanup` drops
|
|
210
|
+
views that are no longer in the schema, before the tables they might read.
|
|
211
|
+
|
|
212
|
+
`@@sql` holds the `SELECT` body; a full `CREATE VIEW ... AS ...` statement pasted
|
|
213
|
+
from a catalog is reduced to that body, so its header and object name are not
|
|
214
|
+
repeated in the generated DDL.
|
|
215
|
+
|
|
216
|
+
Generated clients expose a view through a read-only client — `ViewClient` in
|
|
217
|
+
TypeScript, Python, .NET, Java and Kotlin, `ViewModelClient` in Swift, and
|
|
218
|
+
`ViewClient[T]` in Go and Rust. Those types have the read methods only, so a write
|
|
219
|
+
to a view is rejected at compile time rather than by the database.
|
|
220
|
+
|
|
221
|
+
```an5
|
|
222
|
+
view ActiveUser {
|
|
223
|
+
id NVARCHAR(1000)
|
|
224
|
+
email NVARCHAR(255)
|
|
225
|
+
|
|
226
|
+
@@map("active_users")
|
|
227
|
+
@@sql("SELECT id, email FROM users WHERE active = 1")
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
A longer query can be written over several lines with triple quotes; the indentation
|
|
232
|
+
shared by the SQL lines is removed before it reaches the database:
|
|
233
|
+
|
|
234
|
+
```an5
|
|
235
|
+
view ActiveUser {
|
|
236
|
+
id NVARCHAR(1000)
|
|
237
|
+
email NVARCHAR(255)
|
|
238
|
+
|
|
239
|
+
@@map("active_users")
|
|
240
|
+
@@sql("""
|
|
241
|
+
SELECT id, email
|
|
242
|
+
FROM users
|
|
243
|
+
WHERE active = 1
|
|
244
|
+
""")
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
185
248
|
## License
|
|
186
249
|
|
|
187
250
|
MIT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|