|
1 | | -#!/usr/bin/env python3 |
2 | | -import glob |
3 | | -import json |
4 | 1 | import logging |
5 | 2 | import os |
6 | 3 | import random |
7 | | -import time |
8 | 4 | import uuid |
9 | | -from datetime import datetime, timedelta |
| 5 | +from datetime import datetime |
10 | 6 |
|
11 | 7 | import pyarrow as pa |
12 | 8 | import pytest |
13 | | -import requests |
14 | 9 | import urllib3 |
15 | 10 | from minio import Minio |
16 | 11 | from pyiceberg.catalog import load_catalog |
|
28 | 23 | ) |
29 | 24 |
|
30 | 25 | from helpers.cluster import ClickHouseCluster, ClickHouseInstance, is_arm |
31 | | -from helpers.s3_tools import get_file_contents, list_s3_objects, prepare_s3_bucket |
32 | | -from helpers.test_tools import TSV, csv_compare |
33 | 26 |
|
34 | 27 | import boto3 |
35 | 28 |
|
|
72 | 65 |
|
73 | 66 |
|
74 | 67 | def list_databases(): |
75 | | - client = boto3.client("glue", region_name="us-east-1", endpoint_url=BASE_URL_LOCAL_HOST) |
| 68 | + client = boto3.client( |
| 69 | + "glue", region_name="us-east-1", endpoint_url=BASE_URL_LOCAL_HOST |
| 70 | + ) |
76 | 71 | databases = client.get_databases() |
77 | 72 | return databases |
78 | 73 |
|
79 | 74 |
|
80 | 75 | def load_catalog_impl(started_cluster): |
81 | 76 | return load_catalog( |
82 | | - CATALOG_NAME, # name is not important |
| 77 | + CATALOG_NAME, # name is not important |
83 | 78 | **{ |
84 | 79 | "type": "glue", |
85 | 80 | "glue.endpoint": BASE_URL_LOCAL_HOST, |
86 | 81 | "glue.region": "us-east-1", |
87 | 82 | "s3.endpoint": "http://localhost:9002", |
88 | 83 | "s3.access-key-id": "minio", |
89 | 84 | "s3.secret-access-key": "minio123", |
90 | | - },) |
| 85 | + }, |
| 86 | + ) |
| 87 | + |
91 | 88 |
|
92 | 89 | def create_table( |
93 | 90 | catalog, |
@@ -227,13 +224,12 @@ def test_list_tables(started_cluster): |
227 | 224 |
|
228 | 225 | expected = DEFAULT_CREATE_TABLE.format(CATALOG_NAME, namespace_2, "tableC") |
229 | 226 | print("Expected", expected) |
230 | | - print("Got", node.query( |
231 | | - f"SHOW CREATE TABLE {CATALOG_NAME}.`{namespace_2}.tableC`" |
232 | | - )) |
| 227 | + print("Got", node.query(f"SHOW CREATE TABLE {CATALOG_NAME}.`{namespace_2}.tableC`")) |
233 | 228 | assert expected == node.query( |
234 | 229 | f"SHOW CREATE TABLE {CATALOG_NAME}.`{namespace_2}.tableC`" |
235 | 230 | ) |
236 | 231 |
|
| 232 | + |
237 | 233 | def test_select(started_cluster): |
238 | 234 | node = started_cluster.instances["node1"] |
239 | 235 |
|
@@ -285,13 +281,16 @@ def test_hide_sensitive_info(started_cluster): |
285 | 281 | catalog = load_catalog_impl(started_cluster) |
286 | 282 | catalog.create_namespace(namespace) |
287 | 283 |
|
288 | | - table = create_table(catalog, namespace, table_name) |
| 284 | + create_table(catalog, namespace, table_name) |
289 | 285 |
|
290 | 286 | create_clickhouse_glue_database( |
291 | 287 | started_cluster, |
292 | 288 | node, |
293 | 289 | CATALOG_NAME, |
294 | | - additional_settings={"aws_access_key_id": "SECRET_1", "aws_secret_access_key": "SECRET_2"}, |
| 290 | + additional_settings={ |
| 291 | + "aws_access_key_id": "SECRET_1", |
| 292 | + "aws_secret_access_key": "SECRET_2", |
| 293 | + }, |
295 | 294 | ) |
296 | 295 | assert "SECRET_1" not in node.query(f"SHOW CREATE DATABASE {CATALOG_NAME}") |
297 | 296 | assert "SECRET_2" not in node.query(f"SHOW CREATE DATABASE {CATALOG_NAME}") |
0 commit comments