dbworkload 0.6.1__tar.gz → 0.6.3__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.
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.1
2
+ Name: dbworkload
3
+ Version: 0.6.3
4
+ Summary: Workload framework
5
+ Home-page: https://dbworkload.github.io/dbworkload/
6
+ License: GPLv3+
7
+ Author: Fabio Ghirardello
8
+ Requires-Python: >=3.8,<4.0
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
10
+ Classifier: License :: Other/Proprietary License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Provides-Extra: all
20
+ Provides-Extra: cassandra
21
+ Provides-Extra: mariadb
22
+ Provides-Extra: mongo
23
+ Provides-Extra: mysql
24
+ Provides-Extra: odbc
25
+ Provides-Extra: oracle
26
+ Provides-Extra: postgres
27
+ Provides-Extra: spanner
28
+ Requires-Dist: cassandra-driver ; extra == "all" or extra == "cassandra"
29
+ Requires-Dist: google-cloud-spanner ; extra == "all" or extra == "spanner"
30
+ Requires-Dist: jinja2
31
+ Requires-Dist: mariadb ; extra == "all" or extra == "mariadb"
32
+ Requires-Dist: mysql-connector-python ; extra == "all" or extra == "mysql"
33
+ Requires-Dist: numpy
34
+ Requires-Dist: oracledb ; extra == "all" or extra == "oracle"
35
+ Requires-Dist: pandas
36
+ Requires-Dist: plotext
37
+ Requires-Dist: plotly
38
+ Requires-Dist: prometheus-client
39
+ Requires-Dist: psycopg ; extra == "all" or extra == "postgres"
40
+ Requires-Dist: psycopg-binary ; extra == "all" or extra == "postgres"
41
+ Requires-Dist: pymongo ; extra == "all" or extra == "mongo"
42
+ Requires-Dist: pyodbc ; extra == "all" or extra == "odbc"
43
+ Requires-Dist: pytdigest
44
+ Requires-Dist: pyyaml
45
+ Requires-Dist: sqlparse
46
+ Requires-Dist: tabulate
47
+ Requires-Dist: typer[all]
48
+ Project-URL: Repository, https://github.com/dbworkload/dbworkload
49
+ Description-Content-Type: text/markdown
50
+
51
+ # dbworkload - DBMS workload utility
52
+
53
+ Visit the [online documentation](https://dbworkload.github.io/dbworkload/).
54
+
@@ -4,7 +4,6 @@ from .. import __version__
4
4
  from dbworkload.cli.dep import Param, EPILOG, ConnInfo
5
5
  from enum import Enum
6
6
  from pathlib import Path
7
- from typer.main import get_command
8
7
  from typing import Optional
9
8
  from urllib.parse import urlparse
10
9
  import dbworkload.cli.util
@@ -298,5 +297,6 @@ def version_option(
298
297
  ) -> None:
299
298
  pass
300
299
 
300
+
301
301
  # this is only needed for mkdocs-click
302
- click_app = get_command(app)
302
+ click_app = typer.main.get_command(app)
@@ -7,6 +7,7 @@ import pandas as pd
7
7
  import uuid
8
8
  import random
9
9
  import builtins
10
+ from .common import import_class_at_runtime
10
11
 
11
12
  logger = logging.getLogger("dbworkload")
12
13
 
@@ -584,6 +585,9 @@ class SimpleFaker:
584
585
  return [SimpleFaker.Bit(seed=s, **args) for s in seeds]
585
586
  elif obj_type == "bytes":
586
587
  return [SimpleFaker.Bytes(seed=s, **args) for s in seeds]
588
+ elif obj_type == "custom":
589
+ custom_gen = import_class_at_runtime(args.pop("path"))
590
+ return [custom_gen(seed=s, **args) for s in seeds]
587
591
  else:
588
592
  raise ValueError(
589
593
  f"SimpleFaker type not implemented or recognized: '{obj_type}'"
@@ -610,47 +614,57 @@ class SimpleFaker:
610
614
  separator (str): the field delimiter in the CSV file
611
615
  compression (str): the compression format (gzip, zip, None..)
612
616
  """
617
+
618
+ def gen_to_csv(iters: int):
619
+ # create individual Series and then concat them together
620
+ df = pd.concat(
621
+ [pd.Series([next(gen) for _ in range(iters)]) for gen in generators],
622
+ axis=1,
623
+ keys=col_names,
624
+ )
625
+
626
+ # get a list of the colums that are not to be sorted by
627
+ remaining = list(set(col_names) - set(sort_by))
628
+
629
+ # create a dataframe by concatenating:
630
+ # 1 - the df subset with the sort_by columns sorted by the sort_by columns
631
+ # 2 - the df subset with the remaining columns
632
+ # finally order the columns by the original col_names
633
+ # then save to csv
634
+ pd.concat(
635
+ [
636
+ df[sort_by].sort_values(sort_by).reset_index(drop=True),
637
+ df[remaining],
638
+ ],
639
+ axis=1,
640
+ )[col_names].to_csv(
641
+ basename + "_" + str(counter) + suffix,
642
+ quoting=csv.QUOTE_MINIMAL,
643
+ sep=separator,
644
+ header=False,
645
+ index=False,
646
+ compression=compression,
647
+ )
648
+
613
649
  logger.debug("SimpleFaker worker created")
614
650
  if iterations > self.csv_max_rows:
615
- count = int(iterations / self.csv_max_rows)
651
+ count = iterations // self.csv_max_rows
616
652
  rem = iterations % self.csv_max_rows
617
653
  iterations = self.csv_max_rows
618
654
  else:
619
655
  count = 1
620
656
  rem = 0
621
657
 
622
- if separator == "\t":
623
- suffix = ".tsv"
624
- else:
625
- suffix = ".csv"
626
-
627
- if compression == "gzip":
628
- suffix += ".gz"
629
- elif compression == "zip":
630
- suffix += ".zip"
631
- elif compression == "bz2":
632
- suffix += ".bz2"
633
- elif compression == "xz":
634
- suffix += ".xz"
635
-
636
- for x in range(count):
658
+ suffix = ".tsv" if separator == "\t" else ".csv"
659
+
660
+ if compression:
661
+ suffix += "." + {
662
+ "gzip": "gz",
663
+ }.get(compression, compression)
664
+
665
+ for counter in range(count):
637
666
  try:
638
- pd.DataFrame(
639
- [
640
- row
641
- for row in [
642
- [next(x) for x in generators] for _ in range(iterations)
643
- ]
644
- ],
645
- columns=col_names,
646
- ).sort_values(by=sort_by).to_csv(
647
- basename + "_" + str(x) + suffix,
648
- quoting=csv.QUOTE_MINIMAL,
649
- sep=separator,
650
- header=False,
651
- index=False,
652
- compression=compression,
653
- )
667
+ gen_to_csv(iterations)
654
668
  except csv.Error as e:
655
669
  logger.error(e)
656
670
  if e.args[0] == "need to escape, but no escapechar set":
@@ -658,20 +672,11 @@ class SimpleFaker:
658
672
  f"You cannot use the selected delimiter '{separator}'. Consider using another char or the the tab key."
659
673
  )
660
674
 
661
- logger.debug(f"Saved file '{basename + '_' + str(x) + suffix}'")
675
+ logger.debug(f"Saved file '{basename + '_' + str(counter) + suffix}'")
662
676
 
663
677
  # remaining rows, if any
664
678
  if rem > 0:
665
- pd.DataFrame(
666
- [row for row in [[next(x) for x in generators] for _ in range(rem)]],
667
- columns=col_names,
668
- ).sort_values(by=sort_by).to_csv(
669
- basename + "_" + str(count) + suffix,
670
- quoting=csv.QUOTE_MINIMAL,
671
- sep=separator,
672
- header=False,
673
- index=False,
674
- compression=compression,
675
- )
679
+ counter = count
680
+ gen_to_csv(rem)
676
681
 
677
- logger.debug(f"Saved file '{basename + '_' + str(x) + suffix}'")
682
+ logger.debug(f"Saved file '{basename + '_' + str(counter) + suffix}'")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dbworkload"
3
- version = "0.6.1"
3
+ version = "0.6.3"
4
4
  description = "Workload framework"
5
5
  authors = ["Fabio Ghirardello"]
6
6
  license = "GPLv3+"
@@ -18,26 +18,26 @@ dbworkload = 'dbworkload.cli.main:app'
18
18
 
19
19
  [tool.poetry.dependencies]
20
20
  python = "^3.8"
21
- pandas = "^1.5.2"
22
- tabulate = "^0.9.0"
23
- numpy = "^1.23.5"
24
- prometheus-client = "^0.15.0"
25
- pyyaml = "^6.0"
26
- typer = {extras = ["all"], version = "^0.7.0"}
27
- cassandra-driver = {version = "^3.29.1", optional = true}
28
- mysql-connector-python = {version = "^8.4.0", optional = true}
29
- oracledb = {version = "^2.2.0", optional = true}
30
- psycopg = {version = "^3.1.19", optional = true}
31
- psycopg-binary = {version = "^3.1.19", optional = true}
32
- pymongo = {version = "^4.7.2", optional = true}
33
- pyodbc = {version = "^5.1.0", optional = true}
34
- mariadb = {version = "^1.1.10", optional = true}
35
- google-cloud-spanner = {version = "^3.49.1", optional = true}
36
- pytdigest = "^0.1.4"
37
- plotext = "^5.2.8"
38
- plotly = "^5.24.0"
39
- jinja2 = "^3.1.4"
40
- sqlparse = "^0.5.1"
21
+ pandas = "*"
22
+ tabulate = "*"
23
+ numpy = "*"
24
+ prometheus-client = "*"
25
+ pyyaml = "*"
26
+ typer = {extras = ["all"], version = "*"}
27
+ cassandra-driver = {version = "*", optional = true}
28
+ mysql-connector-python = {version = "*", optional = true}
29
+ oracledb = {version = "*", optional = true}
30
+ psycopg = {version = "*", optional = true}
31
+ psycopg-binary = {version = "*", optional = true}
32
+ pymongo = {version = "*", optional = true}
33
+ pyodbc = {version = "*", optional = true}
34
+ mariadb = {version = "*", optional = true}
35
+ google-cloud-spanner = {version = "*", optional = true}
36
+ pytdigest = "*"
37
+ plotext = "*"
38
+ plotly = "*"
39
+ jinja2 = "*"
40
+ sqlparse = "*"
41
41
 
42
42
  [tool.poetry.extras]
43
43
  all = ["psycopg", "psycopg-binary", "mysql-connector-python", "mariadb", "oracledb", "pyodbc", "pymongo", "cassandra-driver", "google-cloud-spanner"]
dbworkload-0.6.1/PKG-INFO DELETED
@@ -1,53 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: dbworkload
3
- Version: 0.6.1
4
- Summary: Workload framework
5
- Home-page: https://dbworkload.github.io/dbworkload/
6
- License: GPLv3+
7
- Author: Fabio Ghirardello
8
- Requires-Python: >=3.8,<4.0
9
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
10
- Classifier: License :: Other/Proprietary License
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Provides-Extra: all
19
- Provides-Extra: cassandra
20
- Provides-Extra: mariadb
21
- Provides-Extra: mongo
22
- Provides-Extra: mysql
23
- Provides-Extra: odbc
24
- Provides-Extra: oracle
25
- Provides-Extra: postgres
26
- Provides-Extra: spanner
27
- Requires-Dist: cassandra-driver (>=3.29.1,<4.0.0) ; extra == "all" or extra == "cassandra"
28
- Requires-Dist: google-cloud-spanner (>=3.49.1,<4.0.0) ; extra == "all" or extra == "spanner"
29
- Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
30
- Requires-Dist: mariadb (>=1.1.10,<2.0.0) ; extra == "all" or extra == "mariadb"
31
- Requires-Dist: mysql-connector-python (>=8.4.0,<9.0.0) ; extra == "all" or extra == "mysql"
32
- Requires-Dist: numpy (>=1.23.5,<2.0.0)
33
- Requires-Dist: oracledb (>=2.2.0,<3.0.0) ; extra == "all" or extra == "oracle"
34
- Requires-Dist: pandas (>=1.5.2,<2.0.0)
35
- Requires-Dist: plotext (>=5.2.8,<6.0.0)
36
- Requires-Dist: plotly (>=5.24.0,<6.0.0)
37
- Requires-Dist: prometheus-client (>=0.15.0,<0.16.0)
38
- Requires-Dist: psycopg (>=3.1.19,<4.0.0) ; extra == "all" or extra == "postgres"
39
- Requires-Dist: psycopg-binary (>=3.1.19,<4.0.0) ; extra == "all" or extra == "postgres"
40
- Requires-Dist: pymongo (>=4.7.2,<5.0.0) ; extra == "all" or extra == "mongo"
41
- Requires-Dist: pyodbc (>=5.1.0,<6.0.0) ; extra == "all" or extra == "odbc"
42
- Requires-Dist: pytdigest (>=0.1.4,<0.2.0)
43
- Requires-Dist: pyyaml (>=6.0,<7.0)
44
- Requires-Dist: sqlparse (>=0.5.1,<0.6.0)
45
- Requires-Dist: tabulate (>=0.9.0,<0.10.0)
46
- Requires-Dist: typer[all] (>=0.7.0,<0.8.0)
47
- Project-URL: Repository, https://github.com/dbworkload/dbworkload
48
- Description-Content-Type: text/markdown
49
-
50
- # dbworkload - DBMS workload utility
51
-
52
- Visit the [online documentation](https://dbworkload.github.io/dbworkload/).
53
-
File without changes
File without changes