You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"QueryFilter": "Timestamp ge datetime\u00272023-05-15T03:30:32.663Z\u0027"
147
+
},
148
+
"SinkSettings": {
149
+
"FilePath": "D:\\output\\filtered-data.json",
150
+
"Indented": true
151
+
}
152
+
}
153
+
```
154
+
155
+
> **Note**: When using DateTime filters in the `QueryFilter` property, single quotes around the datetime value must be JSON-escaped as `\u0027`. The datetime must be in ISO 8601 format with the `datetime` prefix.
Copy file name to clipboardExpand all lines: Extensions/AzureTableAPI/README.md
+121Lines changed: 121 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,89 @@ The following setting is supported for the Source:
28
28
29
29
-`QueryFilter` - This enables you to specify an OData filter to be applied to the data being retrieved by the AzureTableAPI Source. This is used in cases where only a subset of data from the source Table is needed in the migration. Example usage to query a subset of entities from the source table: `PartitionKey eq 'foo'`.
30
30
31
+
#### Query Filter Examples
32
+
33
+
The `QueryFilter` setting supports OData filter syntax for querying Azure Table API entities. Below are examples of common filter patterns:
34
+
35
+
**Basic Filters:**
36
+
```json
37
+
"QueryFilter": "PartitionKey eq 'WI'"
38
+
```
39
+
40
+
**DateTime Filters:**
41
+
42
+
When filtering by `Timestamp` or other datetime properties, you must use the `datetime` prefix with ISO 8601 format timestamps. In JSON configuration files, single quotes around the datetime value must be JSON-escaped as `\u0027`:
To filter entities within a date range, combine multiple conditions with `and`:
59
+
60
+
```json
61
+
"QueryFilter": "Timestamp ge datetime\u00272023-01-01T00:00:00Z\u0027 and Timestamp lt datetime\u00272024-01-01T00:00:00Z\u0027"
62
+
```
63
+
64
+
**Combined Filters:**
65
+
66
+
You can combine partition key filters with datetime filters for more efficient queries:
67
+
68
+
```json
69
+
"QueryFilter": "PartitionKey eq \u0027users\u0027 and Timestamp ge datetime\u00272023-05-15T00:00:00Z\u0027"
70
+
```
71
+
72
+
> **Important Notes:**
73
+
> - DateTime values must be in ISO 8601 format: `YYYY-MM-DDTHH:mm:ss.fffZ`
74
+
> - The `datetime` prefix is required before the timestamp value
75
+
> - Single quotes around datetime values must be JSON-escaped as `\u0027` in JSON configuration files
76
+
> - The `Z` suffix indicates UTC time
77
+
> - For better query performance, include `PartitionKey` in your filter when possible
78
+
> - Supported datetime operators: `eq` (equal), `ne` (not equal), `gt` (greater than), `ge` (greater than or equal), `lt` (less than), `le` (less than or equal)
79
+
80
+
#### Troubleshooting Common DateTime Filter Issues
81
+
82
+
The following table analyzes common mistakes when specifying datetime filters. Each row shows a query that was attempted and identifies the specific issues:
83
+
84
+
| Query Filter | Missing `datetime` Prefix | Wrong Date Format | Incorrect Encoding | Result |
|`"QueryFilter": "Timestamp ge datetime\u00272023-05-17T03:06:07.691Z\u0027"`| ✅ Correct | ✅ Correct (ISO 8601) | ✅ Correct (`\u0027`) | ✅ Should work*|
87
+
|`"QueryFilter": "Timestamp le datetime\u00272023-05-17T03:06:07.691Z\u0027"`| ✅ Correct | ✅ Correct (ISO 8601) | ✅ Correct (`\u0027`) | ✅ Should work*|
88
+
|`"QueryFilter": "Timestamp eq datetime\u00272023-05-17T03:06:07.691Z\u0027"`| ✅ Correct | ✅ Correct (ISO 8601) | ✅ Correct (`\u0027`) | ✅ Should work*|
89
+
|`"QueryFilter": "Timestamp gt datetime\u00272023-05-17T03:06:07.691Z\u0027"`| ✅ Correct | ✅ Correct (ISO 8601) | ✅ Correct (`\u0027`) | ✅ Should work*|
90
+
|`"QueryFilter": "Timestamp ge datetime '2023-05-17T03:06:07.691Z'"`| ✅ Correct | ✅ Correct (ISO 8601) | ❌ Space before quote, not JSON-escaped | ❌ Invalid syntax |
91
+
|`"QueryFilter": "Timestamp le datetime '2023-05-17T03:06:07.691Z'"`| ✅ Correct | ✅ Correct (ISO 8601) | ❌ Space before quote, not JSON-escaped | ❌ Invalid syntax |
92
+
|`"QueryFilter": "Timestamp gt datetime '2023-05-17T03:06:07.691Z'"`| ✅ Correct | ✅ Correct (ISO 8601) | ❌ Space before quote, not JSON-escaped | ❌ Invalid syntax |
93
+
|`"QueryFilter": "Timestamp eq datetime '2023-05-17T03:06:07.691Z'"`| ✅ Correct | ✅ Correct (ISO 8601) | ❌ Space before quote, not JSON-escaped | ❌ Invalid syntax |
94
+
|`"QueryFilter": "Timestamp ge datetime'\u00272023-05-17T03:06:07.691Z\u0027'"`| ✅ Correct | ✅ Correct (ISO 8601) | ❌ Extra quote at end | ❌ Invalid syntax |
95
+
|`"QueryFilter": "Timestamp eq \u00272023-05-17T03:06:07.691Z\u0027"`| ❌ Missing | ✅ Correct (ISO 8601) | ✅ Correct (`\u0027`) | ❌ No data (invalid) |
96
+
|`"QueryFilter": "Timestamp ge datetime '2023-05-17T03:10:39.058Z\u002B00:00'"`| ✅ Correct | ❌ Invalid timezone format | ❌ Space before quote, mixed encoding | ❌ Transfer fails |
97
+
|`"QueryFilter": "Timestamp ge datetime '2023-05-17T03:10:39.058Z\u002B00'"`| ✅ Correct | ❌ Invalid timezone format | ❌ Space before quote, mixed encoding | ❌ Transfer fails |
98
+
|`"QueryFilter": "Timestamp ge datetime 2023-05-17T03:10:39.058Z\u002B00"`| ✅ Correct | ❌ Invalid timezone format | ❌ No quotes around datetime | ❌ Transfer fails |
99
+
|`"QueryFilter": "Timestamp ge datetime'u00272023-05-17T03:06:07.691Zu0027'"`| ✅ Correct | ✅ Correct (ISO 8601) | ❌ Wrong escape sequence (missing `\`) | ❌ Transfer fails |
100
+
|`"QueryFilter": "Timestamp eq '\u00272023-05-17T03:06:07.691Z\u0027'"`| ❌ Missing | ✅ Correct (ISO 8601) | ❌ Extra quote at end | ❌ Transfer fails |
101
+
102
+
\***Note**: The first four queries are syntactically correct. If they returned no data, it may be because:
103
+
- No entities exist with timestamps matching the filter criteria
104
+
- The specific timestamp value doesn't match any entity timestamps (especially with `eq` operator)
105
+
- For exact matches with `eq`, consider using `ge` (greater than or equal) or `le` (less than or equal) operators instead, as table timestamps include high-precision fractional seconds
106
+
107
+
**Key Takeaways:**
108
+
1. Always use `datetime` prefix before the timestamp value
109
+
2. Always use ISO 8601 format: `YYYY-MM-DDTHH:mm:ss.fffZ`
110
+
3. Always JSON-escape single quotes as `\u0027` (not literal `'` characters)
111
+
4. No spaces between `datetime` and the opening quote
112
+
5. Timezone should be `Z` for UTC, not `+00:00` or other formats
113
+
31
114
### Additional Sink Settings
32
115
33
116
The AzureTableAPI Sink extension has additional settings that can be configured for writing Table entities.
@@ -106,3 +189,41 @@ The following are a couple example `settings.json` files for configuring the Azu
106
189
"MaxConcurrentEntityWrites": 5
107
190
}
108
191
```
192
+
193
+
### Example DateTime Filter Configurations
194
+
195
+
The following examples demonstrate how to use datetime filters in the `QueryFilter` setting:
196
+
197
+
**Example 1: Filter entities modified after a specific date**
0 commit comments