-
Notifications
You must be signed in to change notification settings - Fork 78
Profiler CLI #1623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Profiler CLI #1623
Changes from 237 commits
e61dd3e
bfa8490
65bd96f
e578178
73b36c2
8e95927
cabf93a
ec33f67
440cc70
d6fcabb
2988569
f0c87d6
0764e01
d188705
68b0f83
5bd9408
5899a3c
3cdbf7e
822da6b
299d293
9186b89
18f9b42
877a239
492a12f
d0ca03f
603aa0f
204c639
1af4de9
75fbfb5
de87a2a
3288543
2768763
b5bf390
1d9673f
fb66dd3
be954be
92f3d68
aea2178
0d6a047
c528807
eabdf29
9308475
c1a5913
79100e4
35aa15d
7458e3b
f4c63b9
8912f1f
af3ffdc
b192d10
8e6bffa
f053e7d
ab4ae41
b3a4cdd
02a0a56
cc5aea8
f58c9c9
d54589b
72ebe58
699d317
bdb0052
8bf4023
7ea7a3c
4782c14
37caa5f
e91a6d9
37e3b6e
a74cf51
a0324c5
0e7af90
2af79ca
8665b3e
849f67e
e541c22
f642683
05d20e3
40fc5ec
e153a91
dab0fbf
ba305ba
76d2e1f
ef09e51
414574f
0dbe824
480a590
d90cc7b
b23ad5f
1fbd1b2
1359234
ebce184
094e442
1991d8f
01f7850
7900fba
c0e7bf8
9bd424f
a4c9491
5e2709b
c43fd7f
3c76d7f
e271bc3
570384b
dff71af
6508981
f5216c5
4951a22
c0b98ae
08503d9
dfa0e85
9151f69
a2f5289
bbc9775
81ce857
e44af22
1d0375c
1bf1106
ffdb9a8
b00ff9e
b5120b3
5682bfe
3e874d8
a7f585c
741eb63
228ed24
dec2b71
37fd059
01b0868
dfc2d87
3cc3c83
d7ee063
562e3a6
29cdca6
b3f531b
0130766
89f908e
bc9239d
d38abfc
2678720
9219f0f
d0960b7
d7c9196
10077f3
67545d6
c36bb95
5f13f0f
46dcee6
153f224
7cf7c5c
b969785
7b0acd5
8f4405c
8a745dc
400b586
bfe2c37
33a42c8
abbe23b
34b6d9b
c095e8f
9e56b8e
a230739
be9b358
dcf8ee9
3dedb84
ee2a99e
a045625
aeb2e00
6c0a539
028fadf
18ff36c
177e69b
26fc1ed
eee4c24
ffc33aa
9853440
4c386bd
ac77f81
f916a99
afd8272
75c5b5b
8a631ed
26fd78a
11e38d3
e1e23f2
baef44e
9111c31
6d0de29
a604e0b
ec2c1e4
599cbf5
baf0eb3
da0c85c
e8f59a4
b8a6c70
ae841e7
354a461
d56958c
9925b44
d305754
eac40a3
c79c01a
2195df6
ccba2df
9a9e909
635b84a
c23cb0e
53b3fa9
be777f6
4763885
6f8997c
4992e6b
1a5288f
9df6d0b
9e55fe8
393dbe9
11da6d9
3dc6f88
6085fca
cb38bf5
13417bf
53429c4
b660e4a
3dd7455
5dbb664
b262013
6f547d2
fc076cd
fe50a8b
a08f4ab
3fb3165
773cbba
5643750
1c40b90
451caf2
77cc4a7
e2c0819
a5630cd
9847822
a3d03d6
0e659b0
37029bb
fca09b9
e3f7215
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,12 @@ | |
|
|
||
|
|
||
| from databricks.labs.lakebridge.assessments.configure_assessment import create_assessment_configurator | ||
| from databricks.labs.lakebridge.assessments import PROFILER_SOURCE_SYSTEM | ||
| from databricks.labs.lakebridge.assessments import PROFILER_SOURCE_SYSTEM, PRODUCT_NAME | ||
| from databricks.labs.lakebridge.assessments.profiler import Profiler | ||
|
|
||
| from databricks.labs.lakebridge.config import TranspileConfig, LSPConfigOptionV1 | ||
| from databricks.labs.lakebridge.contexts.application import ApplicationContext | ||
| from databricks.labs.lakebridge.connections.credential_manager import cred_file | ||
| from databricks.labs.lakebridge.helpers.recon_config_utils import ReconConfigPrompts | ||
| from databricks.labs.lakebridge.helpers.telemetry_utils import make_alphanum_or_semver | ||
| from databricks.labs.lakebridge.install import installer | ||
|
|
@@ -701,18 +703,19 @@ def configure_secrets(*, w: WorkspaceClient) -> None: | |
| recon_conf.prompt_and_save_connection_details() | ||
|
|
||
|
|
||
| @lakebridge.command(is_unauthenticated=True) | ||
| def configure_database_profiler() -> None: | ||
| """[Experimental] Install the lakebridge Assessment package""" | ||
| prompts = Prompts() | ||
|
|
||
| # Prompt for source system | ||
| source_system = str( | ||
| prompts.choice("Please select the source system you want to configure", PROFILER_SOURCE_SYSTEM) | ||
| ).lower() | ||
| @lakebridge.command | ||
| def configure_database_profiler(w: WorkspaceClient) -> None: | ||
| """[Experimental] Installs and runs the Lakebridge Assessment package for database profiling""" | ||
| ctx = ApplicationContext(w) | ||
| ctx.add_user_agent_extra("cmd", "configure-profiler") | ||
| prompts = ctx.prompts | ||
| source_tech = prompts.choice("Select the source technology", PROFILER_SOURCE_SYSTEM).lower() | ||
| ctx.add_user_agent_extra("profiler_source_tech", make_alphanum_or_semver(source_tech)) | ||
| user = ctx.current_user | ||
| logger.debug(f"User: {user}") | ||
|
|
||
| # Create appropriate assessment configurator | ||
| assessment = create_assessment_configurator(source_system=source_system, product_name="lakebridge", prompts=prompts) | ||
| assessment = create_assessment_configurator(source_system=source_tech, product_name="lakebridge", prompts=prompts) | ||
| assessment.run() | ||
|
|
||
|
|
||
|
|
@@ -810,6 +813,51 @@ def analyze( | |
| logger.debug(f"User: {ctx.current_user}") | ||
|
|
||
|
|
||
| @lakebridge.command() | ||
| def execute_database_profiler(w: WorkspaceClient, source_tech: str | None = None) -> None: | ||
| """Execute the Profiler Extraction for the given source technology""" | ||
sundarshankar89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ctx = ApplicationContext(w) | ||
| ctx.add_user_agent_extra("cmd", "execute-profiler") | ||
| prompts = ctx.prompts | ||
| if source_tech is None: | ||
| source_tech = prompts.choice("Select the source technology", PROFILER_SOURCE_SYSTEM) | ||
| source_tech = source_tech.lower() | ||
|
|
||
| if source_tech not in PROFILER_SOURCE_SYSTEM: | ||
| logger.error(f"Only the following source systems are supported: {PROFILER_SOURCE_SYSTEM}") | ||
sundarshankar89 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| raise_validation_exception(f"Invalid source technology {source_tech}") | ||
|
|
||
| ctx.add_user_agent_extra("profiler_source_tech", make_alphanum_or_semver(source_tech)) | ||
| user = ctx.current_user | ||
| logger.debug(f"User: {user}") | ||
| # check if cred_file is present which has the connection details before running the profiler | ||
| file = cred_file(PRODUCT_NAME) | ||
| if not file.exists(): | ||
| raise_validation_exception( | ||
| f"Connection details not found. Please run `databricks labs lakebridge configure-database-profiler` " | ||
| f"to set up connection details for {source_tech}." | ||
| ) | ||
| profiler = Profiler.create(source_tech) | ||
|
|
||
| # TODO: Add extractor logic to ApplicationContext instead of creating inside the Profiler class | ||
| profiler.profile() | ||
|
|
||
|
|
||
| @lakebridge.command() | ||
| def create_profiler_dashboard( | ||
| *, | ||
| w: WorkspaceClient, | ||
| extract_file: str, | ||
| source_tech: str, | ||
| catalog_name: str, | ||
| schema_name: str, | ||
| ) -> None: | ||
| """Deploys a profiler summary as a Databricks dashboard.""" | ||
| ctx = ApplicationContext(w) | ||
| ctx.add_user_agent_extra("cmd", "create-profiler-dashboard") | ||
| ctx.dashboard_manager.create_profiler_summary_dashboard(extract_file, source_tech, catalog_name, schema_name) | ||
|
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| lakebridge() | ||
| if is_in_debug(): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.