PostBOUND 0.19.0__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.
- postbound/__init__.py +211 -0
- postbound/_base.py +6 -0
- postbound/_bench.py +1012 -0
- postbound/_core.py +1153 -0
- postbound/_hints.py +1373 -0
- postbound/_jointree.py +1079 -0
- postbound/_pipelines.py +1121 -0
- postbound/_qep.py +1986 -0
- postbound/_stages.py +876 -0
- postbound/_validation.py +734 -0
- postbound/db/__init__.py +72 -0
- postbound/db/_db.py +2348 -0
- postbound/db/_duckdb.py +785 -0
- postbound/db/mysql.py +1195 -0
- postbound/db/postgres.py +4216 -0
- postbound/experiments/__init__.py +12 -0
- postbound/experiments/analysis.py +674 -0
- postbound/experiments/benchmarking.py +54 -0
- postbound/experiments/ceb.py +877 -0
- postbound/experiments/interactive.py +105 -0
- postbound/experiments/querygen.py +334 -0
- postbound/experiments/workloads.py +980 -0
- postbound/optimizer/__init__.py +92 -0
- postbound/optimizer/__init__.pyi +73 -0
- postbound/optimizer/_cardinalities.py +369 -0
- postbound/optimizer/_joingraph.py +1150 -0
- postbound/optimizer/dynprog.py +1825 -0
- postbound/optimizer/enumeration.py +432 -0
- postbound/optimizer/native.py +539 -0
- postbound/optimizer/noopt.py +54 -0
- postbound/optimizer/presets.py +147 -0
- postbound/optimizer/randomized.py +650 -0
- postbound/optimizer/tonic.py +1479 -0
- postbound/optimizer/ues.py +1607 -0
- postbound/qal/__init__.py +343 -0
- postbound/qal/_qal.py +9678 -0
- postbound/qal/formatter.py +1089 -0
- postbound/qal/parser.py +2344 -0
- postbound/qal/relalg.py +4257 -0
- postbound/qal/transform.py +2184 -0
- postbound/shortcuts.py +70 -0
- postbound/util/__init__.py +46 -0
- postbound/util/_errors.py +33 -0
- postbound/util/collections.py +490 -0
- postbound/util/dataframe.py +71 -0
- postbound/util/dicts.py +330 -0
- postbound/util/jsonize.py +68 -0
- postbound/util/logging.py +106 -0
- postbound/util/misc.py +168 -0
- postbound/util/networkx.py +401 -0
- postbound/util/numbers.py +438 -0
- postbound/util/proc.py +107 -0
- postbound/util/stats.py +37 -0
- postbound/util/system.py +48 -0
- postbound/util/typing.py +35 -0
- postbound/vis/__init__.py +5 -0
- postbound/vis/fdl.py +69 -0
- postbound/vis/graphs.py +48 -0
- postbound/vis/optimizer.py +538 -0
- postbound/vis/plots.py +84 -0
- postbound/vis/tonic.py +70 -0
- postbound/vis/trees.py +105 -0
- postbound-0.19.0.dist-info/METADATA +355 -0
- postbound-0.19.0.dist-info/RECORD +67 -0
- postbound-0.19.0.dist-info/WHEEL +5 -0
- postbound-0.19.0.dist-info/licenses/LICENSE.txt +202 -0
- postbound-0.19.0.dist-info/top_level.txt +1 -0
postbound/db/__init__.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""The `db` module provides tools to interact with various database instances.
|
|
2
|
+
|
|
3
|
+
Generally speaking, the interactions are bidirectional: on the one hand, common database concepts like retrieving statistical
|
|
4
|
+
information, introspecting the logical schema or obtaining physical query execution plans are enabled through abstract
|
|
5
|
+
interfaces and can be used by the optimizer modules. On the other hand, the `db` modules provides tools to enforce optimization
|
|
6
|
+
decisions made as part of an optimization pipeline or other modules when executing the query on the actual database system.
|
|
7
|
+
|
|
8
|
+
Recall that PostBOUND does not interact with the query optimizer directly and instead relies on system-specific hints or other
|
|
9
|
+
special properties of the target database system to influence the optimizer behaviour. Therefore, the optimization process
|
|
10
|
+
usually terminates with transforming the original input query to a logically equivalent query that at the same time contains
|
|
11
|
+
the necessary modifications for optimization.
|
|
12
|
+
|
|
13
|
+
The central entrypoint to all database interaction is the abstract `Database` class. This class is inherited by all supported
|
|
14
|
+
database systems (currently PostgreSQL and MySQL). Each `Database` instace provides some basic functionality on its own (such
|
|
15
|
+
as the ability to execute queries), but delegates most of the work to specific and tailored interfaces. For example, the
|
|
16
|
+
`DatabaseSchema` models all access to the logical schema of a database and the `OptimizerInterface` encapsulates the
|
|
17
|
+
functionality to retrieve cost estimates or phyiscal query execution plans. All of these interfaces are once again abstract and
|
|
18
|
+
implemented according to the specifics of the actual database system.
|
|
19
|
+
|
|
20
|
+
Take a look at the individual interfaces for further information about their functionality and intended usage.
|
|
21
|
+
|
|
22
|
+
This module provide direct access to the Postgres interface along with a shortcut method to retrieve the current database
|
|
23
|
+
(aptly called `current_database`). In the background, this method delegates to the `DatabasePool`.
|
|
24
|
+
If you want to use the MySQL interface, make sure to install PostBOUND with MySQL support enabled and import `mysql` from
|
|
25
|
+
the `db` package.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
from ._db import (
|
|
31
|
+
Connection,
|
|
32
|
+
Cursor,
|
|
33
|
+
DatabasePool,
|
|
34
|
+
DatabaseSchema,
|
|
35
|
+
DatabaseServerError,
|
|
36
|
+
DatabaseStatistics,
|
|
37
|
+
DatabaseUserError,
|
|
38
|
+
ForeignKeyRef,
|
|
39
|
+
HintService,
|
|
40
|
+
HintWarning,
|
|
41
|
+
OptimizerInterface,
|
|
42
|
+
PrewarmingSupport,
|
|
43
|
+
QueryCacheWarning,
|
|
44
|
+
StopwatchSupport,
|
|
45
|
+
TimeoutSupport,
|
|
46
|
+
UnsupportedDatabaseFeatureError,
|
|
47
|
+
current_database,
|
|
48
|
+
simplify_result_set,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
"postgres",
|
|
53
|
+
"duckdb",
|
|
54
|
+
"Cursor",
|
|
55
|
+
"Connection",
|
|
56
|
+
"PrewarmingSupport",
|
|
57
|
+
"TimeoutSupport",
|
|
58
|
+
"StopwatchSupport",
|
|
59
|
+
"QueryCacheWarning",
|
|
60
|
+
"ForeignKeyRef",
|
|
61
|
+
"DatabaseSchema",
|
|
62
|
+
"DatabaseStatistics",
|
|
63
|
+
"HintWarning",
|
|
64
|
+
"HintService",
|
|
65
|
+
"OptimizerInterface",
|
|
66
|
+
"DatabasePool",
|
|
67
|
+
"UnsupportedDatabaseFeatureError",
|
|
68
|
+
"DatabaseServerError",
|
|
69
|
+
"DatabaseUserError",
|
|
70
|
+
"current_database",
|
|
71
|
+
"simplify_result_set",
|
|
72
|
+
]
|