Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source-klaviyo: fix incremental pagination #2037

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source-klaviyo/source_klaviyo/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def request_params(
# Setting a minimum value of at least 3 seconds from the current time ensures this will never happen,
# and allows our 'abnormal_state' acceptance test to pass.
latest_cursor = min(latest_cursor, pendulum.now().subtract(seconds=3))
params["filter"] = f"greater-than({self.cursor_field},{latest_cursor.isoformat()})"
params["filter"] = f"greater-or-equal({self.cursor_field},{latest_cursor.isoformat()})"
params["sort"] = self.cursor_field
return params

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
[
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "campaigns",
"resourceConfig": {
"cursorField": [
"updated_at"
],
"stream": "campaigns",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "events",
"resourceConfig": {
"cursorField": [
"datetime"
],
"stream": "events",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "global_exclusions",
"resourceConfig": {
"cursorField": [
"updated"
],
"stream": "global_exclusions",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "lists",
"resourceConfig": {
"cursorField": [
"updated"
],
"stream": "lists",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "metrics",
"resourceConfig": {
"cursorField": [
"updated"
],
"stream": "metrics",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "flows",
"resourceConfig": {
"cursorField": [
"updated"
],
"stream": "flows",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "email_templates",
"resourceConfig": {
"cursorField": [
"updated"
],
"stream": "email_templates",
"syncMode": "incremental"
}
},
{
"documentSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"properties": {
"_meta": {
"properties": {
"row_id": {
"type": "integer"
}
},
"required": [
"row_id"
],
"type": "object"
},
"id": {
"type": "string"
}
},
"required": [
"id"
],
"type": "object",
"x-infer-schema": true
},
"key": [
"/id"
],
"recommendedName": "profiles",
"resourceConfig": {
"cursorField": [
"updated"
],
"stream": "profiles",
"syncMode": "incremental"
}
}
]

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"api_key": {
"airbyte_secret": true,
"description": "Klaviyo API Key. See our docs if you need help finding this key: https://go.estuary.dev/JqH0gQ",
"order": 0,
"title": "Api Key",
"type": "string"
},
"start_date": {
"description": "UTC date and time in the format 2017-01-25T00:00:00Z. Any data before this date will not be replicated. This field is optional - if not provided, all data will be replicated.",
"examples": [
"2017-01-25T00:00:00Z"
],
"format": "date-time",
"order": 1,
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
"title": "Start Date",
"type": "string"
}
},
"required": [
"api_key"
],
"title": "Klaviyo Spec",
"type": "object"
},
"documentationUrl": "https://go.estuary.dev/JqH0gQ",
"protocol": 3032023,
"resourceConfigSchema": {
"additionalProperties": false,
"description": "ResourceConfig encodes a configured resource stream",
"properties": {
"cursorField": {
"items": {
"type": "string"
},
"title": "Cursor Field",
"type": "array"
},
"namespace": {
"description": "Enclosing schema namespace of this resource",
"title": "Namespace",
"type": "string"
},
"stream": {
"description": "Name of this stream",
"title": "Stream",
"type": "string"
},
"syncMode": {
"description": "Sync this resource incrementally, or fully refresh it every run",
"enum": [
"full_refresh",
"incremental"
],
"title": "Sync Mode",
"type": "string"
}
},
"required": [
"stream",
"syncMode"
],
"title": "ResourceConfig",
"type": "object"
},
"resourcePathPointers": [
"/namespace",
"/stream"
]
}
]

Loading
Loading