1
|
1 |
|
from configparser import ConfigParser |
2
|
1 |
|
from typing import Optional |
3
|
|
|
|
4
|
1 |
|
from pystratum_backend.Backend import Backend |
5
|
1 |
|
from pystratum_backend.ConstantWorker import ConstantWorker |
6
|
1 |
|
from pystratum_backend.RoutineLoaderWorker import RoutineLoaderWorker |
7
|
1 |
|
from pystratum_backend.RoutineWrapperGeneratorWorker import RoutineWrapperGeneratorWorker |
8
|
1 |
|
from pystratum_backend.StratumStyle import StratumStyle |
9
|
|
|
|
10
|
1 |
|
from pystratum_pgsql.backend.PgSqlConstantWorker import PgSqlConstantWorker |
11
|
1 |
|
from pystratum_pgsql.backend.PgSqlRoutineLoaderWorker import PgSqlRoutineLoaderWorker |
12
|
1 |
|
from pystratum_pgsql.backend.PgSqlRoutineWrapperGeneratorWorker import PgSqlRoutineWrapperGeneratorWorker |
13
|
|
|
|
14
|
|
|
|
15
|
1 |
|
class PgSqlBackend(Backend): |
16
|
|
|
""" |
17
|
|
|
Semi interface for PyStratum's backends. |
18
|
|
|
""" |
19
|
|
|
|
20
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
21
|
1 |
|
def create_constant_worker(self, config: ConfigParser, io: StratumStyle) -> Optional[ConstantWorker]: |
22
|
|
|
""" |
23
|
|
|
Creates the object that does the actual execution of the constant command for the backend. |
24
|
|
|
|
25
|
|
|
:param ConfigParser config: The settings from the PyStratum configuration file. |
26
|
|
|
:param StratumStyle io: The output object. |
27
|
|
|
|
28
|
|
|
:rtype: ConstantWorker|None |
29
|
|
|
""" |
30
|
1 |
|
return PgSqlConstantWorker(io, config) |
31
|
|
|
|
32
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
33
|
1 |
|
def create_routine_loader_worker(self, config: ConfigParser, io: StratumStyle) -> Optional[RoutineLoaderWorker]: |
34
|
|
|
""" |
35
|
|
|
Creates the object that does the actual execution of the routine loader command for the backend. |
36
|
|
|
|
37
|
|
|
:param ConfigParser config: The settings from the PyStratum configuration file. |
38
|
|
|
:param StratumStyle io: The output object. |
39
|
|
|
|
40
|
|
|
:rtype: RoutineLoaderWorker|None |
41
|
|
|
""" |
42
|
1 |
|
return PgSqlRoutineLoaderWorker(io, config) |
43
|
|
|
|
44
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
45
|
1 |
|
def create_routine_wrapper_generator_worker(self, config: ConfigParser, io: StratumStyle) \ |
46
|
|
|
-> Optional[RoutineWrapperGeneratorWorker]: |
47
|
|
|
""" |
48
|
|
|
Creates the object that does the actual execution of the routine wrapper generator command for the backend. |
49
|
|
|
|
50
|
|
|
:param ConfigParser config: The settings from the PyStratum configuration file. |
51
|
|
|
:param StratumStyle io: The output object. |
52
|
|
|
|
53
|
|
|
:rtype: RoutineWrapperGeneratorWorker|None |
54
|
|
|
""" |
55
|
1 |
|
return PgSqlRoutineWrapperGeneratorWorker(io, config) |
56
|
|
|
|
57
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
58
|
|
|
|