apexdevkit 1.17.8__tar.gz → 1.17.9__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.
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/PKG-INFO +1 -1
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/mssql.py +20 -13
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/sqlite.py +23 -15
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/pyproject.toml +1 -1
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/LICENSE +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/README.md +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/error.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/request.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/server.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.17.8 → apexdevkit-1.17.9}/apexdevkit/value.py +0 -0
|
@@ -225,11 +225,15 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
225
225
|
FROM [{self.schema}].[{self.table}]
|
|
226
226
|
{self._where_statement(include_id=False)}
|
|
227
227
|
REVERT
|
|
228
|
-
""").with_data(self.
|
|
228
|
+
""").with_data(self._data_with_fixed({}))
|
|
229
229
|
|
|
230
230
|
def insert(self, item: ItemT) -> DatabaseCommand:
|
|
231
|
-
columns = ", ".join(
|
|
232
|
-
|
|
231
|
+
columns = ", ".join(
|
|
232
|
+
["[" + field.name + "]" for field in self.fields if field.include_in_insert]
|
|
233
|
+
)
|
|
234
|
+
placeholders = ", ".join(
|
|
235
|
+
[f"%({key.name})s" for key in self.fields if key.include_in_insert]
|
|
236
|
+
)
|
|
233
237
|
output = ", ".join(["INSERTED." + field.name for field in self.fields])
|
|
234
238
|
|
|
235
239
|
return DatabaseCommand(f"""
|
|
@@ -242,7 +246,7 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
242
246
|
{placeholders}
|
|
243
247
|
)
|
|
244
248
|
REVERT
|
|
245
|
-
""").with_data(self.
|
|
249
|
+
""").with_data(self._data_with_fixed(self.formatter.dump(item)))
|
|
246
250
|
|
|
247
251
|
def select(self, item_id: str) -> DatabaseCommand:
|
|
248
252
|
columns = ", ".join(["[" + field.name + "]" for field in self.fields])
|
|
@@ -254,7 +258,7 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
254
258
|
FROM [{self.schema}].[{self.table}]
|
|
255
259
|
{self._where_statement(include_id=True)}
|
|
256
260
|
REVERT
|
|
257
|
-
""").with_data(self.
|
|
261
|
+
""").with_data(self._data_with_fixed({self._id: item_id}))
|
|
258
262
|
|
|
259
263
|
def select_all(self) -> DatabaseCommand:
|
|
260
264
|
columns = ", ".join(["[" + field.name + "]" for field in self.fields])
|
|
@@ -267,7 +271,7 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
267
271
|
{self._where_statement(include_id=False)}
|
|
268
272
|
{self._order}
|
|
269
273
|
REVERT
|
|
270
|
-
""").with_data(self.
|
|
274
|
+
""").with_data(self._data_with_fixed({}))
|
|
271
275
|
|
|
272
276
|
def update(self, item: ItemT) -> DatabaseCommand:
|
|
273
277
|
updates = ", ".join(
|
|
@@ -285,7 +289,7 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
285
289
|
{updates}
|
|
286
290
|
{self._where_statement(include_id=True)}
|
|
287
291
|
REVERT
|
|
288
|
-
""").with_data(self.
|
|
292
|
+
""").with_data(self._data_with_fixed(self.formatter.dump(item)))
|
|
289
293
|
|
|
290
294
|
def delete(self, item_id: str) -> DatabaseCommand:
|
|
291
295
|
return DatabaseCommand(f"""
|
|
@@ -294,7 +298,7 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
294
298
|
FROM [{self.schema}].[{self.table}]
|
|
295
299
|
{self._where_statement(include_id=True)}
|
|
296
300
|
REVERT
|
|
297
|
-
""").with_data(self.
|
|
301
|
+
""").with_data(self._data_with_fixed({self._id: item_id}))
|
|
298
302
|
|
|
299
303
|
def delete_all(self) -> DatabaseCommand:
|
|
300
304
|
return DatabaseCommand(f"""
|
|
@@ -303,7 +307,7 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
303
307
|
FROM [{self.schema}].[{self.table}]
|
|
304
308
|
{self._where_statement(include_id=False)}
|
|
305
309
|
REVERT
|
|
306
|
-
""").with_data(self.
|
|
310
|
+
""").with_data(self._data_with_fixed({}))
|
|
307
311
|
|
|
308
312
|
def load(self, data: dict[str, Any]) -> ItemT:
|
|
309
313
|
return self.formatter.load(data)
|
|
@@ -324,10 +328,10 @@ class DefaultSqlTable(SqlTable[ItemT]):
|
|
|
324
328
|
statement += f" AND [{self._id}] = %({self._id})s"
|
|
325
329
|
return statement
|
|
326
330
|
|
|
327
|
-
def
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
def _data_with_fixed(self, data: dict[str, Any]) -> dict[str, Any]:
|
|
332
|
+
for field in self.fields:
|
|
333
|
+
if field.is_parent or field.is_fixed:
|
|
334
|
+
data[field.name] = field.fixed_value
|
|
331
335
|
return data
|
|
332
336
|
|
|
333
337
|
@property
|
|
@@ -358,6 +362,9 @@ class MsSqlField:
|
|
|
358
362
|
name: str
|
|
359
363
|
is_id: bool = False
|
|
360
364
|
is_ordered: bool = False
|
|
365
|
+
include_in_insert: bool = True
|
|
361
366
|
|
|
362
367
|
is_parent: bool = False
|
|
368
|
+
|
|
369
|
+
is_fixed: bool = False
|
|
363
370
|
fixed_value: Any | None = None
|
|
@@ -146,20 +146,25 @@ class _DefaultSqlTable(SqlTable[ItemT]):
|
|
|
146
146
|
SELECT count(*) as n_items
|
|
147
147
|
FROM {self.table_name.upper()}
|
|
148
148
|
{self._where_statement(include_id=False)};
|
|
149
|
-
""").with_data(self.
|
|
149
|
+
""").with_data(self._data_with_fixed({}))
|
|
150
150
|
|
|
151
151
|
def insert(self, item: ItemT) -> DatabaseCommand:
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
insert_columns = ", ".join(
|
|
153
|
+
[field.name for field in self.fields if field.include_in_insert]
|
|
154
|
+
)
|
|
155
|
+
return_columns = ", ".join([field.name for field in self.fields])
|
|
156
|
+
placeholders = ", ".join(
|
|
157
|
+
[f":{key.name}" for key in self.fields if key.include_in_insert]
|
|
158
|
+
)
|
|
154
159
|
|
|
155
160
|
return DatabaseCommand(f"""
|
|
156
161
|
INSERT INTO {self.table_name.upper()} (
|
|
157
|
-
{
|
|
162
|
+
{insert_columns}
|
|
158
163
|
) VALUES (
|
|
159
164
|
{placeholders}
|
|
160
165
|
)
|
|
161
|
-
RETURNING {
|
|
162
|
-
""").with_data(self.
|
|
166
|
+
RETURNING {return_columns};
|
|
167
|
+
""").with_data(self._data_with_fixed(self.formatter.dump(item)))
|
|
163
168
|
|
|
164
169
|
def select(self, item_id: str) -> DatabaseCommand:
|
|
165
170
|
columns = ", ".join([field.name for field in self.fields])
|
|
@@ -169,7 +174,7 @@ class _DefaultSqlTable(SqlTable[ItemT]):
|
|
|
169
174
|
{columns}
|
|
170
175
|
FROM {self.table_name.upper()}
|
|
171
176
|
{self._where_statement(include_id=True)};
|
|
172
|
-
""").with_data(self.
|
|
177
|
+
""").with_data(self._data_with_fixed({self._id: item_id}))
|
|
173
178
|
|
|
174
179
|
def select_duplicate(self, item: ItemT) -> DatabaseCommand:
|
|
175
180
|
raw = self.formatter.dump(item)
|
|
@@ -192,7 +197,7 @@ class _DefaultSqlTable(SqlTable[ItemT]):
|
|
|
192
197
|
{columns}
|
|
193
198
|
FROM {self.table_name.capitalize()}
|
|
194
199
|
{self._where_statement(include_id=False)};
|
|
195
|
-
""").with_data(self.
|
|
200
|
+
""").with_data(self._data_with_fixed({}))
|
|
196
201
|
|
|
197
202
|
def update(self, item: ItemT) -> DatabaseCommand:
|
|
198
203
|
updates = ", ".join(
|
|
@@ -208,21 +213,21 @@ class _DefaultSqlTable(SqlTable[ItemT]):
|
|
|
208
213
|
SET
|
|
209
214
|
{updates}
|
|
210
215
|
{self._where_statement(include_id=True)};
|
|
211
|
-
""").with_data(self.
|
|
216
|
+
""").with_data(self._data_with_fixed(self.formatter.dump(item)))
|
|
212
217
|
|
|
213
218
|
def delete(self, item_id: str) -> DatabaseCommand:
|
|
214
219
|
return DatabaseCommand(f"""
|
|
215
220
|
DELETE
|
|
216
221
|
FROM {self.table_name.upper()}
|
|
217
222
|
{self._where_statement(include_id=True)};
|
|
218
|
-
""").with_data(self.
|
|
223
|
+
""").with_data(self._data_with_fixed({self._id: item_id}))
|
|
219
224
|
|
|
220
225
|
def delete_all(self) -> DatabaseCommand:
|
|
221
226
|
return DatabaseCommand(f"""
|
|
222
227
|
DELETE
|
|
223
228
|
FROM {self.table_name.upper()}
|
|
224
229
|
{self._where_statement(include_id=False)};
|
|
225
|
-
""").with_data(self.
|
|
230
|
+
""").with_data(self._data_with_fixed({}))
|
|
226
231
|
|
|
227
232
|
def load(self, data: dict[str, Any]) -> ItemT:
|
|
228
233
|
return self.formatter.load(data)
|
|
@@ -245,10 +250,10 @@ class _DefaultSqlTable(SqlTable[ItemT]):
|
|
|
245
250
|
statement += f" AND {self._id} = :{self._id}"
|
|
246
251
|
return statement
|
|
247
252
|
|
|
248
|
-
def
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
253
|
+
def _data_with_fixed(self, data: dict[str, Any]) -> dict[str, Any]:
|
|
254
|
+
for field in self.fields:
|
|
255
|
+
if field.is_parent or field.is_fixed:
|
|
256
|
+
data[field.name] = field.fixed_value
|
|
252
257
|
return data
|
|
253
258
|
|
|
254
259
|
@property
|
|
@@ -269,6 +274,9 @@ class SqliteField:
|
|
|
269
274
|
name: str
|
|
270
275
|
is_id: bool = False
|
|
271
276
|
is_composite: bool = False
|
|
277
|
+
include_in_insert: bool = True
|
|
272
278
|
|
|
273
279
|
is_parent: bool = False
|
|
280
|
+
|
|
281
|
+
is_fixed: bool = False
|
|
274
282
|
fixed_value: Any | None = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|