dbworkload 0.9.2.dev1__tar.gz → 0.10.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbworkload
3
- Version: 0.9.2.dev1
3
+ Version: 0.10.1
4
4
  Summary: Workload framework
5
5
  License: GPLv3+
6
6
  Author: Fabio Ghirardello
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Provides-Extra: all
16
16
  Provides-Extra: cassandra
17
+ Provides-Extra: convert
17
18
  Provides-Extra: mariadb
18
19
  Provides-Extra: mongo
19
20
  Provides-Extra: mysql
@@ -22,13 +23,20 @@ Provides-Extra: oracle
22
23
  Provides-Extra: postgres
23
24
  Provides-Extra: spanner
24
25
  Requires-Dist: cassandra-driver ; extra == "all" or extra == "cassandra"
26
+ Requires-Dist: fastembed (>=0.7.3,<0.8.0) ; extra == "convert"
25
27
  Requires-Dist: google-cloud-spanner ; extra == "all" or extra == "spanner"
26
28
  Requires-Dist: jinja2
29
+ Requires-Dist: langchain-core (>=1.0.5,<2.0.0) ; extra == "convert"
30
+ Requires-Dist: langchain-ollama (>=1.0.0,<2.0.0) ; extra == "convert"
31
+ Requires-Dist: langchain-openai (>=1.0.2,<2.0.0) ; extra == "convert"
32
+ Requires-Dist: langgraph (>=1.0.3,<2.0.0) ; extra == "convert"
27
33
  Requires-Dist: mariadb ; extra == "all" or extra == "mariadb"
28
34
  Requires-Dist: mysql-connector-python ; extra == "all" or extra == "mysql"
29
35
  Requires-Dist: numpy
36
+ Requires-Dist: openai (>=2.8.0,<3.0.0) ; extra == "convert"
30
37
  Requires-Dist: oracledb ; extra == "all" or extra == "oracle"
31
38
  Requires-Dist: pandas
39
+ Requires-Dist: pgvector (>=0.4.1,<0.5.0) ; extra == "convert"
32
40
  Requires-Dist: plotext
33
41
  Requires-Dist: plotly
34
42
  Requires-Dist: prometheus-client
@@ -42,7 +42,7 @@ app = typer.Typer(
42
42
  )
43
43
 
44
44
 
45
- app.add_typer(dbworkload.cli.util.app, name="util")
45
+ app.add_typer(dbworkload.cli.util.util_app, name="util")
46
46
 
47
47
  version: bool = typer.Option(True)
48
48
 
@@ -1,16 +1,20 @@
1
1
  #!/usr/bin/python
2
2
 
3
+ import sys
3
4
  from enum import Enum
4
5
  from pathlib import Path
5
6
  from typing import Optional
6
7
 
7
8
  import typer
8
9
 
9
- import dbworkload.models.run
10
10
  import dbworkload.models.util
11
- import dbworkload.utils.common
12
11
  from dbworkload.cli.dep import EPILOG, Param
13
12
 
13
+ try:
14
+ from ..models.convert import ConvertTool
15
+ except:
16
+ pass
17
+
14
18
 
15
19
  class Compression(str, Enum):
16
20
  bz2 = "bz2"
@@ -19,14 +23,14 @@ class Compression(str, Enum):
19
23
  zip = "zip"
20
24
 
21
25
 
22
- app = typer.Typer(
26
+ util_app = typer.Typer(
23
27
  epilog=EPILOG,
24
28
  no_args_is_help=True,
25
29
  help="Various utils.",
26
30
  )
27
31
 
28
32
 
29
- @app.command(
33
+ @util_app.command(
30
34
  "csv",
31
35
  epilog=EPILOG,
32
36
  no_args_is_help=True,
@@ -99,7 +103,7 @@ def util_csv(
99
103
  )
100
104
 
101
105
 
102
- @app.command(
106
+ @util_app.command(
103
107
  "yaml",
104
108
  epilog=EPILOG,
105
109
  no_args_is_help=True,
@@ -135,7 +139,7 @@ def util_yaml(
135
139
  dbworkload.models.util.util_yaml(input=input, output=output)
136
140
 
137
141
 
138
- @app.command(
142
+ @util_app.command(
139
143
  "merge_sort",
140
144
  epilog=EPILOG,
141
145
  no_args_is_help=True,
@@ -178,7 +182,7 @@ def util_sort_merge(
178
182
  dbworkload.models.util.util_merge_sort(input, output, csv_max_rows, compress)
179
183
 
180
184
 
181
- @app.command(
185
+ @util_app.command(
182
186
  "plot",
183
187
  epilog=EPILOG,
184
188
  no_args_is_help=True,
@@ -201,7 +205,7 @@ def util_plot(
201
205
  dbworkload.models.util.util_plot(input)
202
206
 
203
207
 
204
- @app.command(
208
+ @util_app.command(
205
209
  "html",
206
210
  epilog=EPILOG,
207
211
  no_args_is_help=True,
@@ -224,7 +228,7 @@ def util_html(
224
228
  dbworkload.models.util.util_html(input)
225
229
 
226
230
 
227
- @app.command(
231
+ @util_app.command(
228
232
  "merge_csvs",
229
233
  epilog=EPILOG,
230
234
  no_args_is_help=True,
@@ -247,7 +251,7 @@ def util_merge_csvs(
247
251
  dbworkload.models.util.util_merge_csvs(input_dir)
248
252
 
249
253
 
250
- @app.command(
254
+ @util_app.command(
251
255
  "gen_stub",
252
256
  epilog=EPILOG,
253
257
  no_args_is_help=True,
@@ -268,3 +272,61 @@ def util_gen_stub(
268
272
  ),
269
273
  ):
270
274
  dbworkload.models.util.util_gen_stub(input_file)
275
+
276
+
277
+ @util_app.command(
278
+ name="convert",
279
+ help="Convert from PL to PL/pgSQL",
280
+ no_args_is_help=True,
281
+ )
282
+ def cli_convert(
283
+ base_dir: Optional[Path] = typer.Option(
284
+ ".",
285
+ "--dir",
286
+ "-d",
287
+ help="Directory path",
288
+ exists=True,
289
+ file_okay=False,
290
+ dir_okay=True,
291
+ writable=False,
292
+ readable=True,
293
+ resolve_path=True,
294
+ ),
295
+ uri: str = typer.Option(
296
+ None,
297
+ "--uri",
298
+ help="The connection URI to the database.",
299
+ ),
300
+ root_file: Optional[str] = typer.Option(
301
+ None,
302
+ "--root-file",
303
+ "-r",
304
+ help="The root_file. Leave empty for processing all *.ddl files.",
305
+ ),
306
+ generator_llm: Optional[str] = typer.Option(
307
+ "Ollama:llama3.2:3b",
308
+ "--generator-llm",
309
+ "-g",
310
+ help="The generator provider:model_name",
311
+ ),
312
+ refiner_llm: Optional[str] = typer.Option(
313
+ "OpenAI:gpt-5",
314
+ "--refiner-llm",
315
+ "-n",
316
+ help="The refiner provider:model_name.",
317
+ ),
318
+ ):
319
+
320
+ try:
321
+ ConvertTool(
322
+ base_dir,
323
+ uri,
324
+ root_file,
325
+ generator_llm,
326
+ refiner_llm,
327
+ # seed,
328
+ # seed_each_time,
329
+ ).run()
330
+ except Exception as e:
331
+ print(e, file=sys.stderr)
332
+ typer.Exit(1)