1
+ source : MSSQL
2
+ target : POSTGRES
3
+
4
+ defaults :
5
+ mode : full-refresh
6
+
7
+ hooks :
8
+ start :
9
+ - type : query
10
+ connection : ' {source.name}'
11
+ query : |
12
+ -- Drop temp tables if they exist
13
+ IF OBJECT_ID('dbo.unique_identifier_test', 'U') IS NOT NULL DROP TABLE dbo.unique_identifier_test;
14
+
15
+ -- Create source table with uniqueidentifier column
16
+ CREATE TABLE dbo.unique_identifier_test (
17
+ id INT PRIMARY KEY,
18
+ guid_col UNIQUEIDENTIFIER DEFAULT NEWID(),
19
+ name VARCHAR(100),
20
+ created_at DATETIME DEFAULT GETDATE()
21
+ );
22
+
23
+ -- Insert test data with specific GUIDs
24
+ INSERT INTO dbo.unique_identifier_test (id, guid_col, name) VALUES
25
+ (1, '6F9619FF-8B86-D011-B42D-00C04FC964FF', 'Test Record 1'),
26
+ (2, 'A0E44FF6-8B86-D011-B42D-00C04FC964FF', 'Test Record 2'),
27
+ (3, NEWID(), 'Test Record 3'),
28
+ (4, NULL, 'Test Record 4 with NULL GUID'),
29
+ (5, '12345678-1234-5678-1234-567812345678', 'Test Record 5');
30
+
31
+ end :
32
+ - type : query
33
+ connection : ' {target.name}'
34
+ query : |
35
+ -- Verify target table structure
36
+ SELECT
37
+ c.COLUMN_NAME,
38
+ c.DATA_TYPE,
39
+ c.CHARACTER_MAXIMUM_LENGTH,
40
+ c.IS_NULLABLE
41
+ FROM INFORMATION_SCHEMA.COLUMNS c
42
+ WHERE c.TABLE_SCHEMA = 'public'
43
+ AND c.TABLE_NAME = 'unique_identifier_test2'
44
+ AND c.COLUMN_NAME = 'guid_col'
45
+ into : column_info
46
+
47
+ - type : log
48
+ message : |
49
+ Target column info:
50
+ {store.column_info}
51
+
52
+ - type : check
53
+ check : store.column_info[0].data_type == "uuid"
54
+ success_message : " guid_col should be 'uuid' type in target PostgreSQL"
55
+
56
+ - type : query
57
+ connection : ' {target.name}'
58
+ query : |
59
+ -- Get all target data
60
+ SELECT
61
+ id,
62
+ guid_col::text as guid_text,
63
+ name
64
+ FROM public.unique_identifier_test2
65
+ ORDER BY id
66
+ into : target_data
67
+
68
+ - type : log
69
+ message : |
70
+ Target data:
71
+ {store.target_data}
72
+
73
+ - type : check
74
+ check : upper(store.target_data[0].guid_text) == "6F9619FF-8B86-D011-B42D-00C04FC964FF"
75
+ success_message : " GUID value for record 1 matches"
76
+
77
+ - type : check
78
+ check : upper(store.target_data[1].guid_text) == "A0E44FF6-8B86-D011-B42D-00C04FC964FF"
79
+ success_message : " GUID value for record 2 matches"
80
+
81
+ - type : check
82
+ check : length(store.target_data[2].guid_text) == 36
83
+ success_message : " GUID value for record 3 has valid format"
84
+
85
+ - type : check
86
+ check : store.target_data[3].guid_text == nil
87
+ success_message : " GUID value for record 4 is NULL as expected"
88
+
89
+ - type : check
90
+ check : upper(store.target_data[4].guid_text) == "12345678-1234-5678-1234-567812345678"
91
+ success_message : " GUID value for record 5 matches"
92
+
93
+ - type : query
94
+ connection : ' {source.name}'
95
+ query : DROP TABLE dbo.unique_identifier_test;
96
+
97
+ - type : query
98
+ connection : ' {target.name}'
99
+ query : DROP TABLE public.unique_identifier_test2;
100
+
101
+ streams :
102
+ dbo.unique_identifier_test :
103
+ object : public.unique_identifier_test2
0 commit comments