-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_export_cluster_objects.bat
More file actions
59 lines (48 loc) · 1.33 KB
/
run_export_cluster_objects.bat
File metadata and controls
59 lines (48 loc) · 1.33 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
@echo off
setlocal enabledelayedexpansion
REM Parse command line arguments to find -o parameter
set "OUTPUT_DIR="
set "OTHER_ARGS="
set "PARSING_OUTPUT=0"
:parse_args
if "%1"=="" goto done_parsing
if "%1"=="-o" (
set "PARSING_OUTPUT=1"
shift
goto parse_args
)
if "%1"=="--output-dir" (
set "PARSING_OUTPUT=1"
shift
goto parse_args
)
if "!PARSING_OUTPUT!"=="1" (
set "OUTPUT_DIR=%1"
set "PARSING_OUTPUT=0"
) else (
set "OTHER_ARGS=!OTHER_ARGS! %1"
)
shift
goto parse_args
:done_parsing
REM Set default output directory if not provided
if "!OUTPUT_DIR!"=="" set "OUTPUT_DIR=exported_schemas"
REM 1. Define venv location (sibling to this .bat)
set VENV_DIR=%~dp0\venv
REM 2. Create venv if it doesn't exist
if not exist "%VENV_DIR%" (
echo Creating virtual environment...
python -m venv "%VENV_DIR%"
)
REM 3. Activate venv
echo Activating virtual environment...
call "%VENV_DIR%\Scripts\activate.bat"
REM 4. Install required modules
echo Installing dependencies...
pip install azure-kusto-data
REM 5. Run the export script(s) with modified output directories
echo Running export-table-schemas.py...
python "%~dp0export-table-schemas.py" !OTHER_ARGS! -o "!OUTPUT_DIR!\Tables"
echo Running export-function-schemas.py...
python "%~dp0export-function-schemas.py" !OTHER_ARGS! -o "!OUTPUT_DIR!\Functions"
endlocal