dbt-platform-helper 11.0.1__py3-none-any.whl → 11.1.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.
Potentially problematic release.
This version of dbt-platform-helper might be problematic. Click here for more details.
- dbt_platform_helper/COMMANDS.md +60 -19
- dbt_platform_helper/commands/database.py +97 -18
- dbt_platform_helper/commands/environment.py +6 -518
- dbt_platform_helper/domain/__init__.py +0 -0
- dbt_platform_helper/domain/database_copy.py +220 -0
- dbt_platform_helper/domain/maintenance_page.py +459 -0
- dbt_platform_helper/providers/load_balancers.py +51 -0
- dbt_platform_helper/utils/aws.py +47 -37
- dbt_platform_helper/utils/validation.py +29 -0
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.1.0.dist-info}/METADATA +2 -1
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.1.0.dist-info}/RECORD +14 -11
- dbt_platform_helper/commands/database_helpers.py +0 -145
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.1.0.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.1.0.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-11.0.1.dist-info → dbt_platform_helper-11.1.0.dist-info}/entry_points.txt +0 -0
dbt_platform_helper/COMMANDS.md
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
- [platform-helper database](#platform-helper-database)
|
|
43
43
|
- [platform-helper database dump](#platform-helper-database-dump)
|
|
44
44
|
- [platform-helper database load](#platform-helper-database-load)
|
|
45
|
+
- [platform-helper database copy](#platform-helper-database-copy)
|
|
45
46
|
- [platform-helper version](#platform-helper-version)
|
|
46
47
|
- [platform-helper version get-platform-helper-for-project](#platform-helper-version-get-platform-helper-for-project)
|
|
47
48
|
|
|
@@ -962,10 +963,12 @@ platform-helper notify add-comment <slack_channel_id> <slack_token>
|
|
|
962
963
|
|
|
963
964
|
[↩ Parent](#platform-helper)
|
|
964
965
|
|
|
966
|
+
Commands to copy data between databases.
|
|
967
|
+
|
|
965
968
|
## Usage
|
|
966
969
|
|
|
967
970
|
```
|
|
968
|
-
platform-helper database (dump|load)
|
|
971
|
+
platform-helper database (dump|load|copy)
|
|
969
972
|
```
|
|
970
973
|
|
|
971
974
|
## Options
|
|
@@ -975,6 +978,7 @@ platform-helper database (dump|load)
|
|
|
975
978
|
|
|
976
979
|
## Commands
|
|
977
980
|
|
|
981
|
+
- [`copy` ↪](#platform-helper-database-copy)
|
|
978
982
|
- [`dump` ↪](#platform-helper-database-dump)
|
|
979
983
|
- [`load` ↪](#platform-helper-database-load)
|
|
980
984
|
|
|
@@ -987,23 +991,20 @@ platform-helper database (dump|load)
|
|
|
987
991
|
## Usage
|
|
988
992
|
|
|
989
993
|
```
|
|
990
|
-
platform-helper database dump --
|
|
991
|
-
--
|
|
992
|
-
--vpc-name <vpc_name>
|
|
994
|
+
platform-helper database dump --from <from_env> --database <database>
|
|
995
|
+
[--app <application>] [--from-vpc <from_vpc>]
|
|
993
996
|
```
|
|
994
997
|
|
|
995
998
|
## Options
|
|
996
999
|
|
|
997
|
-
- `--account-id <text>`
|
|
998
|
-
|
|
999
1000
|
- `--app <text>`
|
|
1000
|
-
|
|
1001
|
-
- `--
|
|
1002
|
-
|
|
1001
|
+
- The application name. Required unless you are running the command from your deploy repo
|
|
1002
|
+
- `--from <text>`
|
|
1003
|
+
- The environment you are dumping data from
|
|
1003
1004
|
- `--database <text>`
|
|
1004
|
-
|
|
1005
|
-
- `--vpc
|
|
1006
|
-
|
|
1005
|
+
- The name of the database you are dumping data from
|
|
1006
|
+
- `--from-vpc <text>`
|
|
1007
|
+
- The vpc the specified environment is running in. Required unless you are running the command from your deploy repo
|
|
1007
1008
|
- `--help <boolean>` _Defaults to False._
|
|
1008
1009
|
- Show this message and exit.
|
|
1009
1010
|
|
|
@@ -1016,22 +1017,62 @@ platform-helper database dump --account-id <account_id> --app <application>
|
|
|
1016
1017
|
## Usage
|
|
1017
1018
|
|
|
1018
1019
|
```
|
|
1019
|
-
platform-helper database load --
|
|
1020
|
-
--
|
|
1021
|
-
--
|
|
1020
|
+
platform-helper database load --to <to_env> --database <database>
|
|
1021
|
+
[--app <application>] [--to-vpc <to_vpc>]
|
|
1022
|
+
[--auto-approve]
|
|
1022
1023
|
```
|
|
1023
1024
|
|
|
1024
1025
|
## Options
|
|
1025
1026
|
|
|
1026
|
-
- `--account-id <text>`
|
|
1027
|
-
|
|
1028
1027
|
- `--app <text>`
|
|
1028
|
+
- The application name. Required unless you are running the command from your deploy repo
|
|
1029
|
+
- `--to <text>`
|
|
1030
|
+
- The environment you are loading data into
|
|
1031
|
+
- `--database <text>`
|
|
1032
|
+
- The name of the database you are loading data into
|
|
1033
|
+
- `--to-vpc <text>`
|
|
1034
|
+
- The vpc the specified environment is running in. Required unless you are running the command from your deploy repo
|
|
1035
|
+
- `--auto-approve <boolean>` _Defaults to False._
|
|
1029
1036
|
|
|
1030
|
-
- `--
|
|
1037
|
+
- `--help <boolean>` _Defaults to False._
|
|
1038
|
+
- Show this message and exit.
|
|
1039
|
+
|
|
1040
|
+
# platform-helper database copy
|
|
1041
|
+
|
|
1042
|
+
[↩ Parent](#platform-helper-database)
|
|
1043
|
+
|
|
1044
|
+
Copy a database between environments.
|
|
1045
|
+
|
|
1046
|
+
## Usage
|
|
1031
1047
|
|
|
1048
|
+
```
|
|
1049
|
+
platform-helper database copy --from <from_env> --to <to_env> --database <database>
|
|
1050
|
+
--svc <service> [--app <application>] [--from-vpc <from_vpc>]
|
|
1051
|
+
[--to-vpc <to_vpc>] [--template (default|migration|dmas-migration)]
|
|
1052
|
+
[--auto-approve] [--no-maintenance-page]
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
## Options
|
|
1056
|
+
|
|
1057
|
+
- `--app <text>`
|
|
1058
|
+
- The application name. Required unless you are running the command from your deploy repo
|
|
1059
|
+
- `--from <text>`
|
|
1060
|
+
- The environment you are copying data from
|
|
1061
|
+
- `--to <text>`
|
|
1062
|
+
- The environment you are copying data into
|
|
1032
1063
|
- `--database <text>`
|
|
1064
|
+
- The name of the database you are copying
|
|
1065
|
+
- `--from-vpc <text>`
|
|
1066
|
+
- The vpc the environment you are copying from is running in. Required unless you are running the command from your deploy repo
|
|
1067
|
+
- `--to-vpc <text>`
|
|
1068
|
+
- The vpc the environment you are copying into is running in. Required unless you are running the command from your deploy repo
|
|
1069
|
+
- `--auto-approve <boolean>` _Defaults to False._
|
|
1033
1070
|
|
|
1034
|
-
- `--
|
|
1071
|
+
- `--svc <text>` _Defaults to ['web']._
|
|
1072
|
+
|
|
1073
|
+
- `--template <choice>` _Defaults to default._
|
|
1074
|
+
- The maintenance page you wish to put up.
|
|
1075
|
+
- `--no-maintenance-page <boolean>` _Defaults to False._
|
|
1035
1076
|
|
|
1036
1077
|
- `--help <boolean>` _Defaults to False._
|
|
1037
1078
|
- Show this message and exit.
|
|
@@ -1,33 +1,112 @@
|
|
|
1
1
|
import click
|
|
2
2
|
|
|
3
|
-
from dbt_platform_helper.commands.
|
|
3
|
+
from dbt_platform_helper.commands.environment import AVAILABLE_TEMPLATES
|
|
4
|
+
from dbt_platform_helper.domain.database_copy import DatabaseCopy
|
|
4
5
|
from dbt_platform_helper.utils.click import ClickDocOptGroup
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
@click.group(chain=True, cls=ClickDocOptGroup)
|
|
8
9
|
def database():
|
|
9
|
-
|
|
10
|
+
"""Commands to copy data between databases."""
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@database.command(name="dump")
|
|
13
|
-
@click.option(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
@click.option(
|
|
15
|
+
"--app",
|
|
16
|
+
type=str,
|
|
17
|
+
help="The application name. Required unless you are running the command from your deploy repo",
|
|
18
|
+
)
|
|
19
|
+
@click.option(
|
|
20
|
+
"--from",
|
|
21
|
+
"from_env",
|
|
22
|
+
type=str,
|
|
23
|
+
required=True,
|
|
24
|
+
help="The environment you are dumping data from",
|
|
25
|
+
)
|
|
26
|
+
@click.option(
|
|
27
|
+
"--database", type=str, required=True, help="The name of the database you are dumping data from"
|
|
28
|
+
)
|
|
29
|
+
@click.option(
|
|
30
|
+
"--from-vpc",
|
|
31
|
+
type=str,
|
|
32
|
+
help="The vpc the specified environment is running in. Required unless you are running the command from your deploy repo",
|
|
33
|
+
)
|
|
34
|
+
def dump(app, from_env, database, from_vpc):
|
|
19
35
|
"""Dump a database into an S3 bucket."""
|
|
20
|
-
data_copy = DatabaseCopy(
|
|
21
|
-
data_copy.dump()
|
|
36
|
+
data_copy = DatabaseCopy(app, database)
|
|
37
|
+
data_copy.dump(from_env, from_vpc)
|
|
22
38
|
|
|
23
39
|
|
|
24
40
|
@database.command(name="load")
|
|
25
|
-
@click.option(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
@click.option(
|
|
42
|
+
"--app",
|
|
43
|
+
type=str,
|
|
44
|
+
help="The application name. Required unless you are running the command from your deploy repo",
|
|
45
|
+
)
|
|
46
|
+
@click.option(
|
|
47
|
+
"--to", "to_env", type=str, required=True, help="The environment you are loading data into"
|
|
48
|
+
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--database", type=str, required=True, help="The name of the database you are loading data into"
|
|
51
|
+
)
|
|
52
|
+
@click.option(
|
|
53
|
+
"--to-vpc",
|
|
54
|
+
type=str,
|
|
55
|
+
help="The vpc the specified environment is running in. Required unless you are running the command from your deploy repo",
|
|
56
|
+
)
|
|
57
|
+
@click.option("--auto-approve/--no-auto-approve", default=False)
|
|
58
|
+
def load(app, to_env, database, to_vpc, auto_approve):
|
|
31
59
|
"""Load a database from an S3 bucket."""
|
|
32
|
-
data_copy = DatabaseCopy(
|
|
33
|
-
data_copy.load()
|
|
60
|
+
data_copy = DatabaseCopy(app, database, auto_approve)
|
|
61
|
+
data_copy.load(to_env, to_vpc)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@database.command(name="copy")
|
|
65
|
+
@click.option(
|
|
66
|
+
"--app",
|
|
67
|
+
type=str,
|
|
68
|
+
help="The application name. Required unless you are running the command from your deploy repo",
|
|
69
|
+
)
|
|
70
|
+
@click.option(
|
|
71
|
+
"--from", "from_env", type=str, required=True, help="The environment you are copying data from"
|
|
72
|
+
)
|
|
73
|
+
@click.option(
|
|
74
|
+
"--to", "to_env", type=str, required=True, help="The environment you are copying data into"
|
|
75
|
+
)
|
|
76
|
+
@click.option(
|
|
77
|
+
"--database", type=str, required=True, help="The name of the database you are copying"
|
|
78
|
+
)
|
|
79
|
+
@click.option(
|
|
80
|
+
"--from-vpc",
|
|
81
|
+
type=str,
|
|
82
|
+
help="The vpc the environment you are copying from is running in. Required unless you are running the command from your deploy repo",
|
|
83
|
+
)
|
|
84
|
+
@click.option(
|
|
85
|
+
"--to-vpc",
|
|
86
|
+
type=str,
|
|
87
|
+
help="The vpc the environment you are copying into is running in. Required unless you are running the command from your deploy repo",
|
|
88
|
+
)
|
|
89
|
+
@click.option("--auto-approve/--no-auto-approve", default=False)
|
|
90
|
+
@click.option("--svc", type=str, required=True, multiple=True, default=["web"])
|
|
91
|
+
@click.option(
|
|
92
|
+
"--template",
|
|
93
|
+
type=click.Choice(AVAILABLE_TEMPLATES),
|
|
94
|
+
default="default",
|
|
95
|
+
help="The maintenance page you wish to put up.",
|
|
96
|
+
)
|
|
97
|
+
@click.option("--no-maintenance-page", flag_value=True)
|
|
98
|
+
def copy(
|
|
99
|
+
app,
|
|
100
|
+
from_env,
|
|
101
|
+
to_env,
|
|
102
|
+
database,
|
|
103
|
+
from_vpc,
|
|
104
|
+
to_vpc,
|
|
105
|
+
auto_approve,
|
|
106
|
+
svc,
|
|
107
|
+
template,
|
|
108
|
+
no_maintenance_page,
|
|
109
|
+
):
|
|
110
|
+
"""Copy a database between environments."""
|
|
111
|
+
data_copy = DatabaseCopy(app, database, auto_approve)
|
|
112
|
+
data_copy.copy(from_env, to_env, from_vpc, to_vpc, svc, template, no_maintenance_page)
|