validio-cli 0.29.0__tar.gz → 5.2.0__tar.gz
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.
- {validio_cli-0.29.0 → validio_cli-5.2.0}/PKG-INFO +1 -1
- {validio_cli-0.29.0 → validio_cli-5.2.0}/pyproject.toml +1 -1
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/sources.py +0 -204
- {validio_cli-0.29.0 → validio_cli-5.2.0}/LICENSE +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/README_PUBLIC.md +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/__init__.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/channels.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/code.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/config.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/credentials.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/dbt.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/filters.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/incidents.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/metrics.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/namespaces.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/notification_rules.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/resources.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/segmentations.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/segments.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/users.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/validators.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/entities/windows.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/bin/main.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/components.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/metadata.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/namespace.py +0 -0
- {validio_cli-0.29.0 → validio_cli-5.2.0}/validio_cli/schema.py +0 -0
|
@@ -3,7 +3,7 @@ name = "validio-cli"
|
|
|
3
3
|
# This version does not represent the released version or any tag. For each
|
|
4
4
|
# release we automatically bump this before building and publishing so this
|
|
5
5
|
# should be kept at 0.0.1dev1
|
|
6
|
-
version = "
|
|
6
|
+
version = "5.2.0"
|
|
7
7
|
description = "CLI tool to interact with the Validio platform"
|
|
8
8
|
authors = ["Validio <support@validio.io>"]
|
|
9
9
|
license = "Apache-2.0"
|
|
@@ -271,13 +271,11 @@ async def _interactive(config_dir: str, filename: Path, namespace: str) -> None:
|
|
|
271
271
|
credential_type_to_source_type = {
|
|
272
272
|
"AwsCredential": [
|
|
273
273
|
("kinesis", "Amazon Kinesis"),
|
|
274
|
-
("s3", "Amazon S3"),
|
|
275
274
|
],
|
|
276
275
|
"DatabricksCredential": [("databricks", "Databricks")],
|
|
277
276
|
"DemoCredential": [("demo", "Demo")],
|
|
278
277
|
"GcpCredential": [
|
|
279
278
|
("bigquery", "Google BigQuery"),
|
|
280
|
-
("gcs", "Google Cloud Storage"),
|
|
281
279
|
("pubsub", "Google Pub/Sub"),
|
|
282
280
|
],
|
|
283
281
|
"PostgreSqlCredential": [("postgresql", "PostgreSQL")],
|
|
@@ -458,29 +456,6 @@ async def _interactive(config_dir: str, filename: Path, namespace: str) -> None:
|
|
|
458
456
|
info.get("message_format", ""),
|
|
459
457
|
info.get("message_schema", ""),
|
|
460
458
|
)
|
|
461
|
-
case "s3":
|
|
462
|
-
info = await _multip_prompt(
|
|
463
|
-
[
|
|
464
|
-
("Bucket", [], ""),
|
|
465
|
-
("File pattern", [], "*.csv"),
|
|
466
|
-
("Prefix", [], ""),
|
|
467
|
-
("CSV delimiter", [",", "|"], ","),
|
|
468
|
-
]
|
|
469
|
-
)
|
|
470
|
-
|
|
471
|
-
print()
|
|
472
|
-
null_marker = await _get_null_marker()
|
|
473
|
-
|
|
474
|
-
await _infer_schema_s3(
|
|
475
|
-
vc,
|
|
476
|
-
filename,
|
|
477
|
-
credential_id,
|
|
478
|
-
info.get("bucket", ""),
|
|
479
|
-
info.get("file_pattern", ""),
|
|
480
|
-
info.get("prefix", ""),
|
|
481
|
-
info.get("csv_delimiter", ""),
|
|
482
|
-
null_marker,
|
|
483
|
-
)
|
|
484
459
|
case "postgresql":
|
|
485
460
|
info = await _multip_prompt(
|
|
486
461
|
[
|
|
@@ -549,31 +524,6 @@ async def _interactive(config_dir: str, filename: Path, namespace: str) -> None:
|
|
|
549
524
|
info.get("dataset", ""),
|
|
550
525
|
info.get("table", ""),
|
|
551
526
|
)
|
|
552
|
-
case "gcs":
|
|
553
|
-
info = await _multip_prompt(
|
|
554
|
-
[
|
|
555
|
-
("Project", [], ""),
|
|
556
|
-
("Bucket", [], ""),
|
|
557
|
-
("Folder", [], ""),
|
|
558
|
-
("File pattern", ["*.csv"], "*.csv"),
|
|
559
|
-
("CSV delimiter", [",", "|"], ","),
|
|
560
|
-
]
|
|
561
|
-
)
|
|
562
|
-
|
|
563
|
-
print()
|
|
564
|
-
null_marker = await _get_null_marker()
|
|
565
|
-
|
|
566
|
-
await _infer_schema_gcs(
|
|
567
|
-
vc,
|
|
568
|
-
filename,
|
|
569
|
-
credential_id,
|
|
570
|
-
info.get("project", ""),
|
|
571
|
-
info.get("bucket", ""),
|
|
572
|
-
info.get("folder", ""),
|
|
573
|
-
info.get("file_pattern", ""),
|
|
574
|
-
info.get("csv_delimiter", ""),
|
|
575
|
-
null_marker,
|
|
576
|
-
)
|
|
577
527
|
case _:
|
|
578
528
|
print("Not yet implemented...")
|
|
579
529
|
return
|
|
@@ -588,40 +538,6 @@ async def demo(
|
|
|
588
538
|
await _infer_schema_demo(vc, filename)
|
|
589
539
|
|
|
590
540
|
|
|
591
|
-
@infer_schema_app.async_command(help="Infer Amazon S3 schema")
|
|
592
|
-
async def s3(
|
|
593
|
-
config_dir: str = ConfigDir,
|
|
594
|
-
filename: Path = schema_filename_option("s3"),
|
|
595
|
-
namespace: str = Namespace(),
|
|
596
|
-
credential_id: str = typer.Option(..., help="Credential name or ID"),
|
|
597
|
-
bucket: str = typer.Option(..., help="S3 bucket name"),
|
|
598
|
-
file_pattern: str = typer.Option(
|
|
599
|
-
"*.csv", help="File glob pattern - files to use for inference"
|
|
600
|
-
),
|
|
601
|
-
prefix: str = typer.Option("", help="Prefix in the bucket, a directory"),
|
|
602
|
-
csv_delimiter: str = typer.Option(",", help="Delimiter between columns in file"),
|
|
603
|
-
null_marker: str = typer.Option(None, help="Null marker (values to treat as NULL)"),
|
|
604
|
-
) -> None:
|
|
605
|
-
vc, cfg = get_client(config_dir)
|
|
606
|
-
|
|
607
|
-
resolved_credential_id = await credentials.get_credential_id(
|
|
608
|
-
vc, cfg, credential_id, namespace
|
|
609
|
-
)
|
|
610
|
-
if resolved_credential_id is None:
|
|
611
|
-
return
|
|
612
|
-
|
|
613
|
-
await _infer_schema_s3(
|
|
614
|
-
vc,
|
|
615
|
-
filename,
|
|
616
|
-
resolved_credential_id,
|
|
617
|
-
bucket,
|
|
618
|
-
file_pattern,
|
|
619
|
-
prefix,
|
|
620
|
-
csv_delimiter,
|
|
621
|
-
null_marker,
|
|
622
|
-
)
|
|
623
|
-
|
|
624
|
-
|
|
625
541
|
@infer_schema_app.async_command(help="Infer Amazon Kinesis schema")
|
|
626
542
|
async def kinesis(
|
|
627
543
|
config_dir: str = ConfigDir,
|
|
@@ -792,40 +708,6 @@ async def bigquery(
|
|
|
792
708
|
)
|
|
793
709
|
|
|
794
710
|
|
|
795
|
-
@infer_schema_app.async_command(help="Infer Google Cloud Storage schema")
|
|
796
|
-
async def gcs(
|
|
797
|
-
config_dir: str = ConfigDir,
|
|
798
|
-
filename: Path = schema_filename_option("gcs"),
|
|
799
|
-
namespace: str = Namespace(),
|
|
800
|
-
credential_id: str = typer.Option(..., help="Credential name or ID"),
|
|
801
|
-
project: str = typer.Option(..., help="Google project name"),
|
|
802
|
-
bucket: str = typer.Option(..., help="GCS bucket"),
|
|
803
|
-
folder: str = typer.Option("", help="Folder in the bucket"),
|
|
804
|
-
file_pattern: str = typer.Option("*.csv", help="File glob"),
|
|
805
|
-
csv_delimiter: str = typer.Option(",", help="Delimiter between columns in file"),
|
|
806
|
-
null_marker: str = typer.Option(None, help="Null marker (values to treat as NULL)"),
|
|
807
|
-
) -> None:
|
|
808
|
-
vc, cfg = get_client(config_dir)
|
|
809
|
-
|
|
810
|
-
resolved_credential_id = await credentials.get_credential_id(
|
|
811
|
-
vc, cfg, credential_id, namespace
|
|
812
|
-
)
|
|
813
|
-
if resolved_credential_id is None:
|
|
814
|
-
return
|
|
815
|
-
|
|
816
|
-
await _infer_schema_gcs(
|
|
817
|
-
vc,
|
|
818
|
-
filename,
|
|
819
|
-
resolved_credential_id,
|
|
820
|
-
project,
|
|
821
|
-
bucket,
|
|
822
|
-
folder,
|
|
823
|
-
file_pattern,
|
|
824
|
-
csv_delimiter,
|
|
825
|
-
null_marker,
|
|
826
|
-
)
|
|
827
|
-
|
|
828
|
-
|
|
829
711
|
async def _infer_schema_databricks(
|
|
830
712
|
vc: APIClient,
|
|
831
713
|
filename: Path,
|
|
@@ -855,32 +737,6 @@ async def _infer_schema_demo(
|
|
|
855
737
|
_write_schema(filename, schema)
|
|
856
738
|
|
|
857
739
|
|
|
858
|
-
async def _infer_schema_s3(
|
|
859
|
-
vc: APIClient,
|
|
860
|
-
filename: Path,
|
|
861
|
-
credential_id: str,
|
|
862
|
-
bucket: str,
|
|
863
|
-
file_pattern: str,
|
|
864
|
-
prefix: str,
|
|
865
|
-
csv_delimiter: str,
|
|
866
|
-
null_marker: str | None,
|
|
867
|
-
) -> None:
|
|
868
|
-
schema = await vc.infer_schema(
|
|
869
|
-
class_name="AwsS3",
|
|
870
|
-
variable_values={
|
|
871
|
-
"credentialId": credential_id,
|
|
872
|
-
"bucket": bucket,
|
|
873
|
-
"filePattern": file_pattern,
|
|
874
|
-
"prefix": prefix,
|
|
875
|
-
"csv": {
|
|
876
|
-
"delimiter": csv_delimiter,
|
|
877
|
-
"nullMarker": null_marker,
|
|
878
|
-
},
|
|
879
|
-
},
|
|
880
|
-
)
|
|
881
|
-
_write_schema(filename, schema)
|
|
882
|
-
|
|
883
|
-
|
|
884
740
|
async def _infer_schema_kinesis(
|
|
885
741
|
vc: APIClient,
|
|
886
742
|
filename: Path,
|
|
@@ -1029,34 +885,6 @@ async def _infer_schema_bigquery(
|
|
|
1029
885
|
_write_schema(filename, schema)
|
|
1030
886
|
|
|
1031
887
|
|
|
1032
|
-
async def _infer_schema_gcs(
|
|
1033
|
-
vc: APIClient,
|
|
1034
|
-
filename: Path,
|
|
1035
|
-
credential_id: str,
|
|
1036
|
-
project: str,
|
|
1037
|
-
bucket: str,
|
|
1038
|
-
folder: str,
|
|
1039
|
-
file_pattern: str,
|
|
1040
|
-
csv_delimiter: str,
|
|
1041
|
-
null_marker: str | None,
|
|
1042
|
-
) -> None:
|
|
1043
|
-
schema = await vc.infer_schema(
|
|
1044
|
-
class_name="GcpStorage",
|
|
1045
|
-
variable_values={
|
|
1046
|
-
"credentialId": credential_id,
|
|
1047
|
-
"project": project,
|
|
1048
|
-
"bucket": bucket,
|
|
1049
|
-
"folder": folder,
|
|
1050
|
-
"filePattern": file_pattern,
|
|
1051
|
-
"csv": {
|
|
1052
|
-
"delimiter": csv_delimiter,
|
|
1053
|
-
"nullMarker": null_marker,
|
|
1054
|
-
},
|
|
1055
|
-
},
|
|
1056
|
-
)
|
|
1057
|
-
_write_schema(filename, schema)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
888
|
def _write_schema(filename: Path, schema: Any) -> None:
|
|
1061
889
|
filename.write_text(json.dumps(schema, indent=2))
|
|
1062
890
|
|
|
@@ -1081,38 +909,6 @@ async def _multip_prompt(questions: list[tuple[str, list[str], str]]) -> dict[st
|
|
|
1081
909
|
return answers
|
|
1082
910
|
|
|
1083
911
|
|
|
1084
|
-
async def _get_null_marker() -> str | None:
|
|
1085
|
-
null_marker = await components.radiolist_dialog(
|
|
1086
|
-
title="Null marker - What value should be treated as NULL",
|
|
1087
|
-
values=[
|
|
1088
|
-
("none", "None (No value is treated as NULL)"),
|
|
1089
|
-
("NULL", "The literal string 'NULL', f.ex. 'a,NULL,c'"),
|
|
1090
|
-
("empty", "Empty (\"\", f.ex 'a,,c')"),
|
|
1091
|
-
("other", "Set manually"),
|
|
1092
|
-
],
|
|
1093
|
-
)
|
|
1094
|
-
|
|
1095
|
-
# User hit escape sequence, don't return None in this case.
|
|
1096
|
-
if null_marker is None:
|
|
1097
|
-
raise typer.Exit(code=1)
|
|
1098
|
-
|
|
1099
|
-
if null_marker == "other":
|
|
1100
|
-
session: PromptSession = PromptSession()
|
|
1101
|
-
null_marker = await session.prompt_async(
|
|
1102
|
-
validio_cli._fixed_width("Null marker"),
|
|
1103
|
-
)
|
|
1104
|
-
|
|
1105
|
-
if null_marker == "none":
|
|
1106
|
-
return None
|
|
1107
|
-
|
|
1108
|
-
# We can't map the value to '""' because it will make it pre-selected in the
|
|
1109
|
-
# dialog which we don't want.
|
|
1110
|
-
if null_marker == "empty":
|
|
1111
|
-
return ""
|
|
1112
|
-
|
|
1113
|
-
return null_marker
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
912
|
async def _get_source_id(
|
|
1117
913
|
session: Session,
|
|
1118
914
|
cfg: ValidioConfig,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|