|
9 | 9 | ConnectionId, |
10 | 10 | DatabaseConnectionConfig, |
11 | 11 | DatabaseType, |
12 | | - DatabricksDeltaS3ConnectionConfig, |
| 12 | + DatabricksConnectionConfig, |
13 | 13 | DynamoConnectionConfig, |
14 | 14 | MongoConnectionConfig, |
15 | 15 | MountedShareConnectionConfig, |
@@ -696,63 +696,67 @@ def test_s3_connection_model_validate_no_iam_role(): |
696 | 696 | assert conn.iam_role_arn is None |
697 | 697 |
|
698 | 698 |
|
699 | | -def test_databricks_delta_s3_connection_model_validate(): |
| 699 | +def test_databricks_connection_model_validate(): |
700 | 700 | payload = { |
701 | | - "id": "11223344-5566-7788-99aa-bbccddeeff00", |
702 | | - "name": "delta_s3", |
703 | | - "mask_type": "file", |
704 | | - "type": "databricks_delta_s3_connection", |
705 | | - "base_directory": "delta/", |
706 | | - "is_file_mask_source": True, |
707 | | - "is_file_mask_destination": False, |
708 | | - "bucket": "my-delta-bucket", |
709 | | - "iam_role_arn": "arn:aws:iam::111122223333:role/delta-role", |
| 701 | + "id": "db-id-1", |
| 702 | + "name": "databricks", |
| 703 | + "mask_type": "database", |
| 704 | + "db_type": "databricks", |
| 705 | + "server_hostname": "adb-1234.azuredatabricks.net", |
| 706 | + "http_path": "/sql/1.0/warehouses/abcd1234", |
| 707 | + "access_token": "dapi1234", |
| 708 | + "catalog": "main", |
| 709 | + "schema": "default", |
| 710 | + "is_read_only": False, |
710 | 711 | } |
711 | 712 |
|
712 | | - conn = DatabricksDeltaS3ConnectionConfig.model_validate(payload) |
| 713 | + conn = DatabricksConnectionConfig.model_validate(payload) |
713 | 714 |
|
714 | | - assert isinstance(conn, DatabricksDeltaS3ConnectionConfig) |
715 | | - assert conn.id == "11223344-5566-7788-99aa-bbccddeeff00" |
716 | | - assert conn.name == "delta_s3" |
717 | | - assert conn.bucket == "my-delta-bucket" |
718 | | - assert conn.base_directory == "delta/" |
719 | | - assert conn.is_file_mask_source is True |
720 | | - assert conn.is_file_mask_destination is False |
721 | | - assert conn.iam_role_arn == "arn:aws:iam::111122223333:role/delta-role" |
| 715 | + assert isinstance(conn, DatabricksConnectionConfig) |
| 716 | + assert conn.id == "db-id-1" |
| 717 | + assert conn.server_hostname == "adb-1234.azuredatabricks.net" |
| 718 | + assert conn.http_path == "/sql/1.0/warehouses/abcd1234" |
| 719 | + assert conn.access_token == "dapi1234" |
| 720 | + assert conn.catalog == "main" |
| 721 | + assert conn.db_schema == "default" |
| 722 | + assert conn.database_type is DatabaseType.databricks |
722 | 723 |
|
723 | 724 |
|
724 | | -def test_databricks_delta_s3_connection_model_validate_no_iam_role(): |
| 725 | +def test_databricks_connection_model_validate_blanks_encrypted_token(): |
725 | 726 | payload = { |
726 | | - "id": "id-delta", |
727 | | - "name": "delta_s3", |
728 | | - "mask_type": "file", |
729 | | - "type": "databricks_delta_s3_connection", |
730 | | - "base_directory": "", |
731 | | - "is_file_mask_source": True, |
732 | | - "is_file_mask_destination": False, |
733 | | - "bucket": "my-delta-bucket", |
| 727 | + "id": "db-id-2", |
| 728 | + "name": "databricks", |
| 729 | + "mask_type": "database", |
| 730 | + "db_type": "databricks", |
| 731 | + "server_hostname": "adb-1234.azuredatabricks.net", |
| 732 | + "http_path": "/sql/1.0/warehouses/abcd1234", |
| 733 | + "access_token_encrypted": "some_base64_here", |
| 734 | + "catalog": "main", |
| 735 | + "is_read_only": False, |
734 | 736 | } |
735 | 737 |
|
736 | | - conn = DatabricksDeltaS3ConnectionConfig.model_validate(payload) |
737 | | - assert conn.iam_role_arn is None |
| 738 | + conn = DatabricksConnectionConfig.model_validate(payload) |
| 739 | + |
| 740 | + assert isinstance(conn, DatabricksConnectionConfig) |
| 741 | + assert conn.access_token is None |
738 | 742 |
|
739 | 743 |
|
740 | | -def test_validate_connection_dispatches_databricks_delta_s3(): |
| 744 | +def test_validate_connection_dispatches_databricks(): |
741 | 745 | payload = { |
742 | | - "id": "aabb-ccdd", |
743 | | - "name": "delta", |
744 | | - "mask_type": "file", |
745 | | - "type": "databricks_delta_s3_connection", |
746 | | - "base_directory": "", |
747 | | - "is_file_mask_source": False, |
748 | | - "is_file_mask_destination": True, |
749 | | - "bucket": "delta-bucket", |
| 746 | + "id": "db-id-3", |
| 747 | + "name": "databricks", |
| 748 | + "mask_type": "database", |
| 749 | + "db_type": "databricks", |
| 750 | + "server_hostname": "adb-1234.azuredatabricks.net", |
| 751 | + "http_path": "/sql/1.0/warehouses/abcd1234", |
| 752 | + "catalog": "main", |
| 753 | + "is_read_only": False, |
750 | 754 | } |
751 | 755 |
|
752 | 756 | conn = validate_connection(payload) |
753 | 757 |
|
754 | | - assert isinstance(conn, DatabricksDeltaS3ConnectionConfig) |
755 | | - assert conn.bucket == "delta-bucket" |
| 758 | + assert isinstance(conn, DatabricksConnectionConfig) |
| 759 | + assert conn.catalog == "main" |
756 | 760 |
|
757 | 761 |
|
758 | 762 | def test_azure_connection_model_validate_blanks_encrypted_connection_string(): |
|
0 commit comments