forked from open-metadata/OpenMetadata
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgather-connector-context.sh
More file actions
executable file
·81 lines (69 loc) · 2.52 KB
/
Copy pathgather-connector-context.sh
File metadata and controls
executable file
·81 lines (69 loc) · 2.52 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
# Gather context about an OpenMetadata connector for review.
# Usage: ./gather-connector-context.sh <service_type> <connector_name>
#
# Example: ./gather-connector-context.sh database mysql
set -euo pipefail
SERVICE_TYPE="${1:?Usage: gather-connector-context.sh <service_type> <connector_name>}"
CONNECTOR_NAME="${2:?Usage: gather-connector-context.sh <service_type> <connector_name>}"
REPO_ROOT="$(git rev-parse --show-toplevel)"
SOURCE_DIR="$REPO_ROOT/ingestion/src/metadata/ingestion/source/$SERVICE_TYPE/$CONNECTOR_NAME"
SPEC_DIR="$REPO_ROOT/openmetadata-spec/src/main/resources/json/schema/entity/services/connections/$SERVICE_TYPE"
TEST_CONN_DIR="$REPO_ROOT/openmetadata-service/src/main/resources/json/data/testConnections/$SERVICE_TYPE"
UNIT_TEST_DIR="$REPO_ROOT/ingestion/tests/unit/topology/$SERVICE_TYPE"
INT_TEST_DIR="$REPO_ROOT/ingestion/tests/integration/$CONNECTOR_NAME"
echo "=== Connector: $CONNECTOR_NAME ($SERVICE_TYPE) ==="
echo ""
echo "--- Source Files ---"
if [ -d "$SOURCE_DIR" ]; then
find "$SOURCE_DIR" -type f -name "*.py" | sort
else
echo "NOT FOUND: $SOURCE_DIR"
fi
echo ""
echo "--- Connection Schema ---"
# Find the schema file (lowerCamelCase naming)
SCHEMA_FILES=$(find "$SPEC_DIR" -maxdepth 1 -name "*${CONNECTOR_NAME}*Connection.json" 2>/dev/null || true)
if [ -n "$SCHEMA_FILES" ]; then
echo "$SCHEMA_FILES"
else
echo "NOT FOUND in $SPEC_DIR"
fi
echo ""
echo "--- Test Connection JSON ---"
TEST_CONN_FILES=$(find "$TEST_CONN_DIR" -maxdepth 1 -name "*.json" 2>/dev/null | grep -i "$CONNECTOR_NAME" || true)
if [ -n "$TEST_CONN_FILES" ]; then
echo "$TEST_CONN_FILES"
else
echo "NOT FOUND in $TEST_CONN_DIR"
fi
echo ""
echo "--- Unit Tests ---"
UNIT_TESTS=$(find "$UNIT_TEST_DIR" -name "test_${CONNECTOR_NAME}*" 2>/dev/null || true)
if [ -n "$UNIT_TESTS" ]; then
echo "$UNIT_TESTS"
else
echo "NOT FOUND in $UNIT_TEST_DIR"
fi
echo ""
echo "--- Integration Tests ---"
if [ -d "$INT_TEST_DIR" ]; then
find "$INT_TEST_DIR" -type f -name "*.py" | sort
else
echo "NOT FOUND: $INT_TEST_DIR"
fi
echo ""
echo "--- Base Class ---"
if [ -f "$SOURCE_DIR/metadata.py" ]; then
grep -E "class .+\(.*Source" "$SOURCE_DIR/metadata.py" || echo "No class found"
fi
echo ""
echo "--- ServiceSpec ---"
if [ -f "$SOURCE_DIR/service_spec.py" ]; then
grep "ServiceSpec" "$SOURCE_DIR/service_spec.py" || echo "No ServiceSpec found"
fi
echo ""
echo "--- Imports Summary ---"
if [ -d "$SOURCE_DIR" ]; then
grep -rh "^from metadata" "$SOURCE_DIR"/*.py 2>/dev/null | sort -u | head -20
fi