|
65 | 65 | },
|
66 | 66 | "cursor_incremental_sync": {
|
67 | 67 | "type": "DatetimeBasedCursor",
|
68 |
| - "cursor_datetime_formats": ["%Y-%m-%dT%H:%M:%SZ", "%Y-%m-%dT%H:%M:%S%z"], |
| 68 | + "cursor_datetime_formats": ["%Y-%m-%dT%H:%M:%SZ", "%Y-%m-%dT%H:%M:%S%z", "%ms"], |
69 | 69 | "datetime_format": "%Y-%m-%dT%H:%M:%SZ",
|
70 | 70 | "cursor_field": "{{ parameters.get('cursor_field', 'updated_at') }}",
|
71 | 71 | "start_datetime": {"datetime": "{{ config.get('start_date')}}"},
|
@@ -399,6 +399,7 @@ def _run_read(
|
399 | 399 | VOTE_200_CREATED_AT = "2024-01-12T00:00:00Z" # Latest vote in partition 20
|
400 | 400 | VOTE_210_CREATED_AT = "2024-01-12T00:00:15Z" # Latest vote in partition 21
|
401 | 401 | VOTE_300_CREATED_AT = "2024-01-10T00:00:00Z" # Latest vote in partition 30
|
| 402 | +VOTE_300_CREATED_AT_TIMESTAMP = 1704844800000 # Latest vote in partition 30 |
402 | 403 |
|
403 | 404 | # Initial State Constants
|
404 | 405 | PARENT_COMMENT_CURSOR_PARTITION_1 = "2023-01-04T00:00:00Z" # Parent comment cursor (partition)
|
@@ -596,7 +597,7 @@ def _run_read(
|
596 | 597 | {
|
597 | 598 | "id": 300,
|
598 | 599 | "comment_id": 30,
|
599 |
| - "created_at": VOTE_300_CREATED_AT, |
| 600 | + "created_at": VOTE_300_CREATED_AT_TIMESTAMP, |
600 | 601 | }
|
601 | 602 | ]
|
602 | 603 | },
|
@@ -637,7 +638,7 @@ def _run_read(
|
637 | 638 | {
|
638 | 639 | "comment_id": 30,
|
639 | 640 | "comment_updated_at": COMMENT_30_UPDATED_AT,
|
640 |
| - "created_at": VOTE_300_CREATED_AT, |
| 641 | + "created_at": str(VOTE_300_CREATED_AT_TIMESTAMP), |
641 | 642 | "id": 300,
|
642 | 643 | },
|
643 | 644 | ],
|
@@ -981,7 +982,15 @@ def run_incremental_parent_state_test(
|
981 | 982 | # Fetch the first page of votes for comment 30 of post 3
|
982 | 983 | (
|
983 | 984 | f"https://api.example.com/community/posts/3/comments/30/votes?per_page=100&start_time={LOOKBACK_DATE}",
|
984 |
| - {"votes": [{"id": 300, "comment_id": 30, "created_at": VOTE_300_CREATED_AT}]}, |
| 985 | + { |
| 986 | + "votes": [ |
| 987 | + { |
| 988 | + "id": 300, |
| 989 | + "comment_id": 30, |
| 990 | + "created_at": VOTE_300_CREATED_AT_TIMESTAMP, |
| 991 | + } |
| 992 | + ] |
| 993 | + }, |
985 | 994 | ),
|
986 | 995 | # Requests with intermediate states
|
987 | 996 | # Fetch votes for comment 10 of post 1
|
@@ -1018,7 +1027,15 @@ def run_incremental_parent_state_test(
|
1018 | 1027 | # Fetch votes for comment 30 of post 3
|
1019 | 1028 | (
|
1020 | 1029 | f"https://api.example.com/community/posts/3/comments/30/votes?per_page=100&start_time={VOTE_300_CREATED_AT}",
|
1021 |
| - {"votes": [{"id": 300, "comment_id": 30, "created_at": VOTE_300_CREATED_AT}]}, |
| 1030 | + { |
| 1031 | + "votes": [ |
| 1032 | + { |
| 1033 | + "id": 300, |
| 1034 | + "comment_id": 30, |
| 1035 | + "created_at": VOTE_300_CREATED_AT_TIMESTAMP, |
| 1036 | + } |
| 1037 | + ] |
| 1038 | + }, |
1022 | 1039 | ),
|
1023 | 1040 | ],
|
1024 | 1041 | # Expected records
|
@@ -1056,7 +1073,7 @@ def run_incremental_parent_state_test(
|
1056 | 1073 | {
|
1057 | 1074 | "comment_id": 30,
|
1058 | 1075 | "comment_updated_at": COMMENT_30_UPDATED_AT,
|
1059 |
| - "created_at": VOTE_300_CREATED_AT, |
| 1076 | + "created_at": str(VOTE_300_CREATED_AT_TIMESTAMP), |
1060 | 1077 | "id": 300,
|
1061 | 1078 | },
|
1062 | 1079 | ],
|
@@ -1344,7 +1361,15 @@ def test_incremental_parent_state(
|
1344 | 1361 | (
|
1345 | 1362 | f"https://api.example.com/community/posts/3/comments/30/votes"
|
1346 | 1363 | f"?per_page=100&start_time={PARTITION_SYNC_START_TIME}",
|
1347 |
| - {"votes": [{"id": 300, "comment_id": 30, "created_at": VOTE_300_CREATED_AT}]}, |
| 1364 | + { |
| 1365 | + "votes": [ |
| 1366 | + { |
| 1367 | + "id": 300, |
| 1368 | + "comment_id": 30, |
| 1369 | + "created_at": VOTE_300_CREATED_AT_TIMESTAMP, |
| 1370 | + } |
| 1371 | + ] |
| 1372 | + }, |
1348 | 1373 | ),
|
1349 | 1374 | ],
|
1350 | 1375 | # Expected records
|
@@ -1382,7 +1407,7 @@ def test_incremental_parent_state(
|
1382 | 1407 | {
|
1383 | 1408 | "comment_id": 30,
|
1384 | 1409 | "comment_updated_at": COMMENT_30_UPDATED_AT,
|
1385 |
| - "created_at": VOTE_300_CREATED_AT, |
| 1410 | + "created_at": str(VOTE_300_CREATED_AT_TIMESTAMP), |
1386 | 1411 | "id": 300,
|
1387 | 1412 | },
|
1388 | 1413 | ],
|
@@ -1896,7 +1921,15 @@ def test_incremental_parent_state_no_records(
|
1896 | 1921 | (
|
1897 | 1922 | f"https://api.example.com/community/posts/3/comments/30/votes"
|
1898 | 1923 | f"?per_page=100&start_time={LOOKBACK_DATE}",
|
1899 |
| - {"votes": [{"id": 300, "comment_id": 30, "created_at": VOTE_300_CREATED_AT}]}, |
| 1924 | + { |
| 1925 | + "votes": [ |
| 1926 | + { |
| 1927 | + "id": 300, |
| 1928 | + "comment_id": 30, |
| 1929 | + "created_at": VOTE_300_CREATED_AT_TIMESTAMP, |
| 1930 | + } |
| 1931 | + ] |
| 1932 | + }, |
1900 | 1933 | ),
|
1901 | 1934 | ],
|
1902 | 1935 | # Expected records
|
@@ -1928,7 +1961,7 @@ def test_incremental_parent_state_no_records(
|
1928 | 1961 | {
|
1929 | 1962 | "comment_id": 30,
|
1930 | 1963 | "comment_updated_at": COMMENT_30_UPDATED_AT,
|
1931 |
| - "created_at": VOTE_300_CREATED_AT, |
| 1964 | + "created_at": str(VOTE_300_CREATED_AT_TIMESTAMP), |
1932 | 1965 | "id": 300,
|
1933 | 1966 | },
|
1934 | 1967 | ],
|
|
0 commit comments