Aazam Thakur
05/04/2023, 6:02 PMkapa.ai
05/04/2023, 6:02 PMkapa.ai
05/04/2023, 6:03 PMAazam Thakur
05/04/2023, 6:48 PMdefinitions:
selector:
extractor:
field_path:
- "{{ parameters['name'] }}"
requester:
url_base: "<https://api.twilio.com/2010-04-01>"
http_method: "GET"
authenticator:
type: BasicHttpAuthenticator
username: "{{ config['account_sid'] }}"
password: "{{ config['auth_token'] }}"
datetime_cursor:
type: "DatetimeBasedCursor"
start_datetime:
datetime: "{{ config['start_date'] }}"
datetime_format: "%Y-%m-%d"
end_datetime:
datetime: "{{ now_utc() }}"
datetime_format: "%Y-%m-%d %H:%M:%S.%f+00:00"
step: "P1D"
datetime_format: "%Y-%m-%d"
cursor_granularity: "P1D"
cursor_field: "date"
retriever:
record_selector:
$ref: "#/definitions/selector"
requester:
$ref: "#/definitions/requester"
default_paginator:
type: "DefaultPaginator"
page_size_option:
inject_into: "request_parameter"
field_name: "PageSize"
pagination_strategy:
type: "CursorPagination"
cursor_value: "{{response['next_page_uri']}}"
page_size: 50
page_token_option:
type: RequestPath
base_stream:
retriever:
$ref: "#/definitions/retriever"
base_stream_with_pagination:
retriever:
$ref: "#/definitions/retriever"
paginator:
$ref: "#/definitions/default_paginator"
kapa.ai
05/04/2023, 6:48 PMkapa.ai
05/04/2023, 6:50 PMfield_path
parameter. 2. `requester`: Configures the base URL, HTTP method, and authentication for the API requests. 3. `datetime_cursor`: Defines the incremental sync strategy based on datetime values. 4. `retriever`: Combines the record selector and requester to retrieve data from the API. 5. `default_paginator`: Handles pagination using the DefaultPaginator with a page size option and a cursor-based pagination strategy. You can find more information about these components and their properties in the Airbyte documentation: - [Understanding the YAML file](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file) - [YAML Reference](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference) If you have any specific questions or need help with a particular part of the code, feel free to ask!Aazam Thakur
05/04/2023, 6:51 PMflows_stream:
$ref: "#/definitions/base_stream_with_pagination"
requester:
$ref: "#/definitions/requester"
url_base: "<https://studio.twilio.com/v1>"
$parameters:
name: "flows"
path: "/Flows"
primary_key: "sid"
kapa.ai
05/04/2023, 6:51 PMkapa.ai
05/04/2023, 6:52 PMAazam Thakur
05/04/2023, 6:57 PMkapa.ai
05/04/2023, 6:57 PMkapa.ai
05/04/2023, 6:58 PMAazam Thakur
05/05/2023, 3:34 AMprimary_key: Null
in my manifest.yaml filekapa.ai
05/05/2023, 3:34 AMkapa.ai
05/05/2023, 3:34 AMprimary_key
to null
in your manifest.yaml file. However, this means that the stream will not have a primary key defined for deduplication purposes. If you use the [Incremental Sync - Deduped History](https://docs.airbyte.com/understanding-airbyte/connections/incremental-deduped-history) sync mode, Airbyte will not be able to deduplicate records based on a primary key. If you use the [Incremental Sync - Append](https://docs.airbyte.com/understanding-airbyte/connections/incremental-append) sync mode, a primary key is not required, as this mode does not perform deduplication. Here's an example of how to set the primary key to null
in your manifest.yaml file: yaml your_stream: $ref: "#/definitions/base_stream" $parameters: name: "your_stream_name" primary_key: null path: "/your_stream_path"
Keep in mind that not having a primary key might cause issues with deduplication if you need it in the future.Aazam Thakur
05/05/2023, 4:01 AM{
"type": "TRACE",
"trace": {
"type": "ERROR",
"emitted_at": 1683259199403.2458,
"error": {
"message": "Something went wrong in the connector. See the logs for more details.",
"internal_message": "expected token 'end of print statement', got 'slice'",
"stack_trace": "Traceback (most recent call last):\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/main.py\", line 13, in <module>\n launch(source, sys.argv[1:])\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 156, in launch\n for message in source_entrypoint.run(parsed_args):\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 98, in run\n yield from map(AirbyteEntrypoint.airbyte_message_to_string, self.read(source_spec, config, config_catalog, state))\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/entrypoint.py\", line 132, in read\n yield from self.source.read(self.logger, config, catalog, state)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py\", line 130, in read\n yield from super().read(logger, config, catalog, state)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 139, in read\n raise e\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 120, in read\n yield from self._read_stream(\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 194, in _read_stream\n for record in record_iterator:\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py\", line 324, in _read_full_refresh\n for record_data_or_message in record_data_or_messages:\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py\", line 100, in read_records\n for record in self.retriever.read_records(sync_mode, cursor_field, stream_slice, stream_state):\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py\", line 387, in read_records\n for record in records_generator:\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/http.py\", line 439, in _read_pages\n request, response = self._fetch_next_page(stream_slice, stream_state, next_page_token)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/http.py\", line 454, in _fetch_next_page\n path=self.path(stream_state=stream_state, stream_slice=stream_slice, next_page_token=next_page_token),\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py\", line 305, in path\n return self.requester.get_path(stream_state=self.state, stream_slice=stream_slice, next_page_token=next_page_token)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py\", line 81, in get_path\n path = self.path.eval(self.config, **kwargs)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/interpolation/interpolated_string.py\", line 40, in eval\n return self._interpolation.eval(self.string, config, self.default, parameters=self._parameters, **kwargs)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/interpolation/jinja.py\", line 59, in eval\n result = self._eval(input_str, context)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/interpolation/jinja.py\", line 78, in _eval\n return self._environment.from_string(s).render(context)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/jinja2/environment.py\", line 1105, in from_string\n return cls.from_code(self, self.compile(source), gs, None)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/jinja2/environment.py\", line 768, in compile\n self.handle_exception(source=source_hint)\n File \"/home/alcadeus/airbyte/airbyte-integrations/connectors/source-twilio/.venv/lib/python3.10/site-packages/jinja2/environment.py\", line 936, in handle_exception\n raise rewrite_traceback_stack(source=source)\n File \"<unknown>\", line 1, in template\njinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got 'slice'\n",
"failure_type": "system_error"
}
}
}
kapa.ai
05/05/2023, 4:01 AMkapa.ai
05/05/2023, 4:01 AMAazam Thakur
05/05/2023, 4:03 AM{"type": "LOG", "log": {"level": "FATAL", "message": "expected token 'end of print statement', got 'slice'\nTraceback (most recent call last):\n
kapa.ai
05/05/2023, 4:03 AMkapa.ai
05/05/2023, 4:04 AMAazam Thakur
05/05/2023, 4:14 AMkapa.ai
05/05/2023, 4:14 AMkapa.ai
05/05/2023, 4:14 AM