-
Notifications
You must be signed in to change notification settings - Fork 0
/
easy_config.py
47 lines (34 loc) · 1 KB
/
easy_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from pathlib import Path
import subprocess
def execute_script(script_path):
"""
Executes a Python script using subprocess.
Runs a Python script using the subprocess module.
Args:
script_path (str): Path to the Python script to be executed.
Returns:
None
"""
result = subprocess.run(["python", script_path], capture_output=True, text=True)
if result.returncode == 0:
print("Script executado com sucesso!")
else:
print("Erro ao executar o script:")
print(result.stderr)
def run_scripts():
"""
Runs a series of scripts.
Runs multiple Python scripts located in a specific directory using the
`execute_script` function.
Returns:
None
"""
scripts = [
"create_database.py",
"create_tables.py",
]
script_dir = Path(__file__).parent.joinpath("cartola_etl/scripts")
for script in scripts:
script_path = script_dir / script
execute_script(script_path)
run_scripts()