myrtille 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- myrtille/lib/cfg.py +12 -0
- myrtille/lib/db.py +120 -0
- myrtille/lib/util.py +9 -0
- myrtille/mysql/export.py +59 -0
- myrtille/mysql/generator.py +353 -0
- myrtille/mysql/grammar.lark +692 -0
- myrtille/mysql/parser.py +1093 -0
- myrtille/mysql/types.py +676 -0
- myrtille-0.1.2.dist-info/METADATA +23 -0
- myrtille-0.1.2.dist-info/RECORD +12 -0
- {myrtille-0.1.0.dist-info → myrtille-0.1.2.dist-info}/WHEEL +1 -1
- myrtille-0.1.2.dist-info/licenses/LICENSE +21 -0
- myrtille/__init__.py +0 -2
- myrtille-0.1.0.dist-info/METADATA +0 -6
- myrtille-0.1.0.dist-info/RECORD +0 -5
- myrtille-0.1.0.dist-info/entry_points.txt +0 -2
myrtille/mysql/types.py
ADDED
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
import typing
|
|
3
|
+
|
|
4
|
+
import pydantic
|
|
5
|
+
|
|
6
|
+
###############
|
|
7
|
+
### General ###
|
|
8
|
+
###############
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TextLiteral(pydantic.BaseModel):
|
|
12
|
+
charset: str | None
|
|
13
|
+
text: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class NullLiteral(pydantic.BaseModel):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Literal: typing.TypeAlias = TextLiteral | NullLiteral
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BinaryCharset(pydantic.BaseModel):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Direction(enum.Enum):
|
|
28
|
+
ASC = enum.auto()
|
|
29
|
+
DESC = enum.auto()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
#################
|
|
33
|
+
### Data Type ###
|
|
34
|
+
#################
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Tinyint(pydantic.BaseModel):
|
|
38
|
+
unsigned: bool
|
|
39
|
+
auto_increment: bool
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Smallint(pydantic.BaseModel):
|
|
43
|
+
unsigned: bool
|
|
44
|
+
auto_increment: bool
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class Mediumint(pydantic.BaseModel):
|
|
48
|
+
unsigned: bool
|
|
49
|
+
auto_increment: bool
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Int(pydantic.BaseModel):
|
|
53
|
+
unsigned: bool
|
|
54
|
+
auto_increment: bool
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Bigint(pydantic.BaseModel):
|
|
58
|
+
unsigned: bool
|
|
59
|
+
auto_increment: bool
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class Decimal(pydantic.BaseModel):
|
|
63
|
+
precision: int | None
|
|
64
|
+
scale: int | None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Float(pydantic.BaseModel):
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class Double(pydantic.BaseModel):
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class Bit(pydantic.BaseModel):
|
|
76
|
+
length: int | None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class Datetime(pydantic.BaseModel):
|
|
80
|
+
precision: int | None
|
|
81
|
+
default_now: bool
|
|
82
|
+
on_update_now: bool
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class Timestamp(pydantic.BaseModel):
|
|
86
|
+
precision: int | None
|
|
87
|
+
default_now: bool
|
|
88
|
+
on_update_now: bool
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class Time(pydantic.BaseModel):
|
|
92
|
+
precision: int | None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class Date(pydantic.BaseModel):
|
|
96
|
+
pass
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class Year(pydantic.BaseModel):
|
|
100
|
+
pass
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Char(pydantic.BaseModel):
|
|
104
|
+
length: int
|
|
105
|
+
charset: str | None
|
|
106
|
+
collate: str | None
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class Varchar(pydantic.BaseModel):
|
|
110
|
+
length: int
|
|
111
|
+
charset: str | None
|
|
112
|
+
collate: str | None
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class TinyText(pydantic.BaseModel):
|
|
116
|
+
charset: str | None
|
|
117
|
+
collate: str | None
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class Text(pydantic.BaseModel):
|
|
121
|
+
charset: str | None
|
|
122
|
+
collate: str | None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class MediumText(pydantic.BaseModel):
|
|
126
|
+
charset: str | None
|
|
127
|
+
collate: str | None
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class LongText(pydantic.BaseModel):
|
|
131
|
+
charset: str | None
|
|
132
|
+
collate: str | None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class Enum(pydantic.BaseModel):
|
|
136
|
+
values: list[str]
|
|
137
|
+
charset: str | None
|
|
138
|
+
collate: str | None
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class Set(pydantic.BaseModel):
|
|
142
|
+
values: list[str]
|
|
143
|
+
charset: str | None
|
|
144
|
+
collate: str | None
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class Binary(pydantic.BaseModel):
|
|
148
|
+
length: int
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class Varbinary(pydantic.BaseModel):
|
|
152
|
+
length: int
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class TinyBlob(pydantic.BaseModel):
|
|
156
|
+
pass
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class Blob(pydantic.BaseModel):
|
|
160
|
+
pass
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class MediumBlob(pydantic.BaseModel):
|
|
164
|
+
pass
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class LongBlob(pydantic.BaseModel):
|
|
168
|
+
pass
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class Geometry(pydantic.BaseModel):
|
|
172
|
+
srid: int | None
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class Point(pydantic.BaseModel):
|
|
176
|
+
srid: int | None
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class Linestring(pydantic.BaseModel):
|
|
180
|
+
srid: int | None
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class Polygon(pydantic.BaseModel):
|
|
184
|
+
srid: int | None
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class Geometrycollection(pydantic.BaseModel):
|
|
188
|
+
srid: int | None
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
class Multipoint(pydantic.BaseModel):
|
|
192
|
+
srid: int | None
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class Multilinestring(pydantic.BaseModel):
|
|
196
|
+
srid: int | None
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class Multipolygon(pydantic.BaseModel):
|
|
200
|
+
srid: int | None
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class Json(pydantic.BaseModel):
|
|
204
|
+
pass
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
IntegerDataType: typing.TypeAlias = Tinyint | Smallint | Mediumint | Int | Bigint
|
|
208
|
+
TextDataType: typing.TypeAlias = (
|
|
209
|
+
Char | Varchar | TinyText | Text | MediumText | LongText | Enum | Set
|
|
210
|
+
)
|
|
211
|
+
SpatialDataType: typing.TypeAlias = (
|
|
212
|
+
Geometry
|
|
213
|
+
| Point
|
|
214
|
+
| Linestring
|
|
215
|
+
| Polygon
|
|
216
|
+
| Geometrycollection
|
|
217
|
+
| Multipoint
|
|
218
|
+
| Multilinestring
|
|
219
|
+
| Multipolygon
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
DataType: typing.TypeAlias = (
|
|
223
|
+
IntegerDataType
|
|
224
|
+
| Decimal
|
|
225
|
+
| Float
|
|
226
|
+
| Double
|
|
227
|
+
| Bit
|
|
228
|
+
| Datetime
|
|
229
|
+
| Timestamp
|
|
230
|
+
| Time
|
|
231
|
+
| Date
|
|
232
|
+
| Year
|
|
233
|
+
| TextDataType
|
|
234
|
+
| Binary
|
|
235
|
+
| Varbinary
|
|
236
|
+
| TinyBlob
|
|
237
|
+
| Blob
|
|
238
|
+
| MediumBlob
|
|
239
|
+
| LongBlob
|
|
240
|
+
| SpatialDataType
|
|
241
|
+
| Json
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
##################
|
|
246
|
+
### Attributes ###
|
|
247
|
+
##################
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class ColumnFormat(enum.Enum):
|
|
251
|
+
FIXED = enum.auto()
|
|
252
|
+
DYNAMIC = enum.auto()
|
|
253
|
+
DEFAULT = enum.auto()
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class StorageMedia(enum.Enum):
|
|
257
|
+
DISK = enum.auto()
|
|
258
|
+
MEMORY = enum.auto()
|
|
259
|
+
DEFAULT = enum.auto()
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class GenerationType(enum.Enum):
|
|
263
|
+
VIRTUAL = enum.auto()
|
|
264
|
+
STORED = enum.auto()
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class NonNullableAttribute(pydantic.BaseModel):
|
|
268
|
+
pass
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class NullableAttribute(pydantic.BaseModel):
|
|
272
|
+
pass
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class LiteralDefaultAttribute(pydantic.BaseModel):
|
|
276
|
+
value: Literal
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class ExprDefaultAttribute(pydantic.BaseModel):
|
|
280
|
+
expr: str
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class NowDefaultAttribute(pydantic.BaseModel):
|
|
284
|
+
pass
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class GeneratedAttribute(pydantic.BaseModel):
|
|
288
|
+
expr: str
|
|
289
|
+
type: GenerationType
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
class OnUpdateNowAttribute(pydantic.BaseModel):
|
|
293
|
+
pass
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class CommentAttribute(pydantic.BaseModel):
|
|
297
|
+
comment: TextLiteral
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class InvisibleAttribute(pydantic.BaseModel):
|
|
301
|
+
pass
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
class AutoIncrementAttribute(pydantic.BaseModel):
|
|
305
|
+
pass
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class UnsignedAttribute(pydantic.BaseModel):
|
|
309
|
+
pass
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class CharsetAttribute(pydantic.BaseModel):
|
|
313
|
+
charset: str | BinaryCharset
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
class CollateAttribute(pydantic.BaseModel):
|
|
317
|
+
collate: str
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
class SridAttribute(pydantic.BaseModel):
|
|
321
|
+
srid: int
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
Attribute: typing.TypeAlias = (
|
|
325
|
+
NonNullableAttribute
|
|
326
|
+
| NullableAttribute
|
|
327
|
+
| LiteralDefaultAttribute
|
|
328
|
+
| ExprDefaultAttribute
|
|
329
|
+
| NowDefaultAttribute
|
|
330
|
+
| GeneratedAttribute
|
|
331
|
+
| OnUpdateNowAttribute
|
|
332
|
+
| CommentAttribute
|
|
333
|
+
| ColumnFormat
|
|
334
|
+
| StorageMedia
|
|
335
|
+
| InvisibleAttribute
|
|
336
|
+
| AutoIncrementAttribute
|
|
337
|
+
| UnsignedAttribute
|
|
338
|
+
| CharsetAttribute
|
|
339
|
+
| CollateAttribute
|
|
340
|
+
| SridAttribute
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
DefaultValue: typing.TypeAlias = ExprDefaultAttribute | LiteralDefaultAttribute
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
######################
|
|
347
|
+
### Create Options ###
|
|
348
|
+
######################
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
class Rowformat(enum.Enum):
|
|
352
|
+
DEFAULT = enum.auto()
|
|
353
|
+
DYNAMIC = enum.auto()
|
|
354
|
+
FIXED = enum.auto()
|
|
355
|
+
COMPRESSED = enum.auto()
|
|
356
|
+
REDUNDANT = enum.auto()
|
|
357
|
+
COMPACT = enum.auto()
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
class InsertMethod(enum.Enum):
|
|
361
|
+
NO = enum.auto()
|
|
362
|
+
FIRST = enum.auto()
|
|
363
|
+
LAST = enum.auto()
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
class StorageType(enum.Enum):
|
|
367
|
+
DISK = enum.auto()
|
|
368
|
+
MEMORY = enum.auto()
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
class EngineCreateOption(pydantic.BaseModel):
|
|
372
|
+
name: str
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
class SecondaryEngineCreateOption(pydantic.BaseModel):
|
|
376
|
+
name: str
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class AvgRowLength(pydantic.BaseModel):
|
|
380
|
+
length: int
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
class AutoIncrementCreateOption(pydantic.BaseModel):
|
|
384
|
+
value: int
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
class CommentCreateOption(pydantic.BaseModel):
|
|
388
|
+
comment: TextLiteral
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
class StatsPersistentCreateOption(pydantic.BaseModel):
|
|
392
|
+
option: bool
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
class RowFormatCreateOption(pydantic.BaseModel):
|
|
396
|
+
format: Rowformat
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class CharsetCreateOption(pydantic.BaseModel):
|
|
400
|
+
charset: str | BinaryCharset
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class CollateCreateOption(pydantic.BaseModel):
|
|
404
|
+
collate: str
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
class TablespaceCreateOption(pydantic.BaseModel):
|
|
408
|
+
name: str
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
CreateOption: typing.TypeAlias = (
|
|
412
|
+
EngineCreateOption
|
|
413
|
+
| SecondaryEngineCreateOption
|
|
414
|
+
| AvgRowLength
|
|
415
|
+
| AutoIncrementCreateOption
|
|
416
|
+
| CommentCreateOption
|
|
417
|
+
| StatsPersistentCreateOption
|
|
418
|
+
| RowFormatCreateOption
|
|
419
|
+
| CharsetCreateOption
|
|
420
|
+
| CollateCreateOption
|
|
421
|
+
| TablespaceCreateOption
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
class CreateOptions(pydantic.BaseModel):
|
|
426
|
+
engine: str | None
|
|
427
|
+
secondary_engine: str | None
|
|
428
|
+
max_rows: int | None
|
|
429
|
+
min_rows: int | None
|
|
430
|
+
avg_row_length: int | None
|
|
431
|
+
password: TextLiteral | None
|
|
432
|
+
comment: str | None
|
|
433
|
+
compression: TextLiteral | None
|
|
434
|
+
encryption: TextLiteral | None
|
|
435
|
+
auto_increment: int | None
|
|
436
|
+
pack_keys: bool | None
|
|
437
|
+
stats_auto_recalc: bool | None
|
|
438
|
+
stats_persistent: bool | None
|
|
439
|
+
stats_sample_pages: bool | None
|
|
440
|
+
checksum: int | None
|
|
441
|
+
delay_key_write: int | None
|
|
442
|
+
row_format: Rowformat | None
|
|
443
|
+
union: list[str] | None
|
|
444
|
+
charset: str | None
|
|
445
|
+
collate: str | None
|
|
446
|
+
insert_method: InsertMethod | None
|
|
447
|
+
data_directory: TextLiteral | None
|
|
448
|
+
index_directory: TextLiteral | None
|
|
449
|
+
tablespace: str | None
|
|
450
|
+
storage: StorageType | None
|
|
451
|
+
connection: TextLiteral | None
|
|
452
|
+
key_block_size: int | None
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
##################
|
|
456
|
+
### Constraint ###
|
|
457
|
+
##################
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class IdentifierKeyPart(pydantic.BaseModel):
|
|
461
|
+
identifier: str
|
|
462
|
+
length: int | None
|
|
463
|
+
direction: Direction | None
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
KeyPart: typing.TypeAlias = IdentifierKeyPart
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
class IndexType(enum.Enum):
|
|
470
|
+
BTREE = enum.auto()
|
|
471
|
+
RTREE = enum.auto()
|
|
472
|
+
HASH = enum.auto()
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
class ConstraintEnforcement(enum.Enum):
|
|
476
|
+
ENFORCED = enum.auto()
|
|
477
|
+
NOT_ENFORCED = enum.auto()
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class IndexOptions(pydantic.BaseModel):
|
|
481
|
+
key_block_size: int | None
|
|
482
|
+
comment: str | None
|
|
483
|
+
invisible: bool
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
class RefAction(enum.Enum):
|
|
487
|
+
RESTRICT = enum.auto()
|
|
488
|
+
CASCADE = enum.auto()
|
|
489
|
+
SET_NULL = enum.auto()
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
class OnDeleteRefRule(pydantic.BaseModel):
|
|
493
|
+
action: RefAction
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
class OnUpdateRefRule(pydantic.BaseModel):
|
|
497
|
+
action: RefAction
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
RefRule: typing.TypeAlias = OnDeleteRefRule | OnUpdateRefRule
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
class References(pydantic.BaseModel):
|
|
504
|
+
ref_table: str
|
|
505
|
+
ref_columns: list[str]
|
|
506
|
+
on_update: RefAction | None
|
|
507
|
+
on_delete: RefAction | None
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
class PrimaryConstraint(pydantic.BaseModel):
|
|
511
|
+
type: IndexType | None
|
|
512
|
+
key_list: list[KeyPart]
|
|
513
|
+
options: IndexOptions
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
class UniqueConstraint(pydantic.BaseModel):
|
|
517
|
+
name: str | None
|
|
518
|
+
type: IndexType | None
|
|
519
|
+
key_list: list[KeyPart]
|
|
520
|
+
options: IndexOptions
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
class IndexConstraint(pydantic.BaseModel):
|
|
524
|
+
name: str | None
|
|
525
|
+
type: IndexType | None
|
|
526
|
+
key_list: list[KeyPart]
|
|
527
|
+
options: IndexOptions
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
class FulltextConstraint(pydantic.BaseModel):
|
|
531
|
+
name: str | None
|
|
532
|
+
key_list: list[KeyPart]
|
|
533
|
+
parser: str | None
|
|
534
|
+
options: IndexOptions
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
class SpatialConstraint(pydantic.BaseModel):
|
|
538
|
+
name: str | None
|
|
539
|
+
key_list: list[KeyPart]
|
|
540
|
+
options: IndexOptions
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
class ForeignConstraint(pydantic.BaseModel):
|
|
544
|
+
name: str | None
|
|
545
|
+
columns: list[str]
|
|
546
|
+
references: References
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
class CheckConstraint(pydantic.BaseModel):
|
|
550
|
+
name: str | None
|
|
551
|
+
expr: str
|
|
552
|
+
enforcement: ConstraintEnforcement
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
Constraint: typing.TypeAlias = (
|
|
556
|
+
PrimaryConstraint
|
|
557
|
+
| UniqueConstraint
|
|
558
|
+
| IndexConstraint
|
|
559
|
+
| FulltextConstraint
|
|
560
|
+
| SpatialConstraint
|
|
561
|
+
| ForeignConstraint
|
|
562
|
+
| CheckConstraint
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
#################
|
|
567
|
+
### Partition ###
|
|
568
|
+
#################
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
class EnginePartitionOption_(pydantic.BaseModel):
|
|
572
|
+
engine: str
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
type PartitionOption_ = EnginePartitionOption_
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
class PartitionOptions(pydantic.BaseModel):
|
|
579
|
+
tablespace: str | None
|
|
580
|
+
engine: str | None
|
|
581
|
+
nodegroup: int | None
|
|
582
|
+
max_rows: int | None
|
|
583
|
+
min_rows: int | None
|
|
584
|
+
data_directory: str | None
|
|
585
|
+
index_directory: str | None
|
|
586
|
+
comment: str | None
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
class KeyHashPartition(pydantic.BaseModel):
|
|
590
|
+
name: str
|
|
591
|
+
options: PartitionOptions
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
type ValuesLessThan = list[str | None]
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
class RangePartition(pydantic.BaseModel):
|
|
598
|
+
name: str
|
|
599
|
+
values: ValuesLessThan
|
|
600
|
+
subpartitions: list[KeyHashPartition]
|
|
601
|
+
options: PartitionOptions
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
type ValuesIn = list[str | list[str]]
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
class ListPartition(pydantic.BaseModel):
|
|
608
|
+
name: str
|
|
609
|
+
values: ValuesIn
|
|
610
|
+
subpartitions: list[KeyHashPartition]
|
|
611
|
+
options: PartitionOptions
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
class KeyPartitionType(pydantic.BaseModel):
|
|
615
|
+
linear: bool
|
|
616
|
+
algorithm: typing.Literal[1, 2] | None
|
|
617
|
+
columns: list[str]
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
class HashPartitionType(pydantic.BaseModel):
|
|
621
|
+
linear: bool
|
|
622
|
+
expr: str
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
class Subpartitioning(pydantic.BaseModel):
|
|
626
|
+
type: KeyPartitionType | HashPartitionType
|
|
627
|
+
subpartition_count: int | None
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
class KeyHashPartitioning(pydantic.BaseModel):
|
|
631
|
+
type: KeyPartitionType | HashPartitionType
|
|
632
|
+
partition_count: int | None
|
|
633
|
+
partitions: list[KeyHashPartition]
|
|
634
|
+
sub: None = None
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
class RangePartitioning(pydantic.BaseModel):
|
|
638
|
+
expr_or_columns: str | list[str]
|
|
639
|
+
partitions: list[RangePartition]
|
|
640
|
+
sub: Subpartitioning | None
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
class ListPartitioning(pydantic.BaseModel):
|
|
644
|
+
expr_or_columns: str | list[str]
|
|
645
|
+
partitions: list[ListPartition]
|
|
646
|
+
sub: Subpartitioning | None
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
type Partitioning = KeyHashPartitioning | RangePartitioning | ListPartitioning
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
############
|
|
653
|
+
### Main ###
|
|
654
|
+
############
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
class Column(pydantic.BaseModel):
|
|
658
|
+
name: str
|
|
659
|
+
data_type: DataType
|
|
660
|
+
|
|
661
|
+
non_nullable: bool | None
|
|
662
|
+
default_value: DefaultValue | None
|
|
663
|
+
comment: str | None
|
|
664
|
+
invisible: bool
|
|
665
|
+
|
|
666
|
+
format: ColumnFormat # Default is ColumnFormat.DEFAULT
|
|
667
|
+
storage_media: StorageMedia # Default is StorageMedia.DEFAULT
|
|
668
|
+
generated: GeneratedAttribute | None
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
class Table(pydantic.BaseModel):
|
|
672
|
+
name: str
|
|
673
|
+
columns: list[Column]
|
|
674
|
+
constraints: list[Constraint]
|
|
675
|
+
options: CreateOptions
|
|
676
|
+
partitioning: Partitioning | None
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: myrtille
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary:
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Florian Daude
|
|
8
|
+
Author-email: floriandaude@hotmail.fr
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Requires-Dist: asyncmy2 (>=0.2.19)
|
|
16
|
+
Requires-Dist: cryptography (>=41.0.5)
|
|
17
|
+
Requires-Dist: lark (>=1.1.8)
|
|
18
|
+
Requires-Dist: pydantic (>=2.4.2)
|
|
19
|
+
Requires-Dist: typer (>=0.20.0)
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Myrtille
|
|
23
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
myrtille/lib/cfg.py,sha256=G3EBUVZ1-U1zffyDaetPxH9ROPld-HTPfpq5pxFA214,238
|
|
2
|
+
myrtille/lib/db.py,sha256=g-c3l8p3n-D0sT98qRQfGTS3-ina1ii2ZKoTBBn6q_I,4155
|
|
3
|
+
myrtille/lib/util.py,sha256=SCGGCOHtZNC7KJhoRR3WGbkY4NPKCQPIRZGm3W-H8pg,160
|
|
4
|
+
myrtille/mysql/export.py,sha256=6jSg4nyGVoPifYNERbPx9ORZZJoGWs1HFbFN8CWud3Y,1734
|
|
5
|
+
myrtille/mysql/generator.py,sha256=seHd4-nl3phP2jkR5czJ8GBPnWUtPpt0wlDWqDUno_Y,13599
|
|
6
|
+
myrtille/mysql/grammar.lark,sha256=fYRnXpYNNGj_byNmHCOYlxtWCPYLMuXPGK1mg_F0lWA,35758
|
|
7
|
+
myrtille/mysql/parser.py,sha256=N6cNzwBMLK0ufDib_wWQLER-hRGuyrv4kC0KplPs5UU,31931
|
|
8
|
+
myrtille/mysql/types.py,sha256=3fm9-SRcUL4kVcCGvkWMutz_wWda_IFGuo45OMmtNwk,12337
|
|
9
|
+
myrtille-0.1.2.dist-info/METADATA,sha256=sjGCq3LeXmrkUYGx27DlBkpYKR1a_NyhvVlBDiTXAoY,656
|
|
10
|
+
myrtille-0.1.2.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
|
|
11
|
+
myrtille-0.1.2.dist-info/licenses/LICENSE,sha256=BXWJEJpRF9-J45iS_dINgth3RTbs7wrPpNdB63brMfk,1063
|
|
12
|
+
myrtille-0.1.2.dist-info/RECORD,,
|