-
Notifications
You must be signed in to change notification settings - Fork 0
added dynamic schema #1
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
base: gl-master
Are you sure you want to change the base?
Changes from all commits
09fc42b
7e43311
f079c3a
f199cf0
ccb1927
9e9af40
6074ee6
58e85eb
5557bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "api_token": "api_token", | ||
| "forms_id": ["ids"], | ||
| "start_date": "2019-01-01T00:00:00Z" | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |||||||||||||||||||||||||
| from typing import Dict, Tuple | ||||||||||||||||||||||||||
| from singer import metadata | ||||||||||||||||||||||||||
| from tap_formkeep.streams import STREAMS | ||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||
| import ast | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| LOGGER = singer.get_logger() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -78,3 +80,116 @@ def get_schemas() -> Tuple[Dict, Dict]: | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return schemas, field_metadata | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| DATE_REGEX = re.compile(r"^\d{4}-\d{2}-\d{2}$") | ||||||||||||||||||||||||||
| TIME_REGEX = re.compile(r"^\d{2}:\d{2}(:\d{2})?$") | ||||||||||||||||||||||||||
|
Comment on lines
80
to
+84
|
||||||||||||||||||||||||||
| DATE_REGEX = re.compile(r"^\d{4}-\d{2}-\d{2}$") | |
| TIME_REGEX = re.compile(r"^\d{2}:\d{2}(:\d{2})?$") | |
| # Matches dates in the format YYYY-MM-DD (e.g., 2024-06-01). | |
| DATE_REGEX = re.compile(r"^\d{4}-\d{2}-\d{2}$") | |
| # Matches times in the format HH:MM or HH:MM:SS (e.g., 14:30 or 14:30:59). | |
| TIME_REGEX = re.compile(r"^\d{2}:\d{2}(:\d{2})?$") | |
| # Matches datetimes in the format YYYY-MM-DDTHH:MM:SSZ, with optional timezone offsets or ' UTC'. | |
| # Examples: 2024-06-01T14:30:59Z, 2024-06-01 14:30:59+02:00, 2024-06-01T14:30:59 UTC |
mukeshbhatt18gl marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DATETIME_REGEX pattern allows space as a date-time separator (pattern includes [T ]), but this does not produce RFC 3339 compliant datetime strings. Per coding guideline #1000000 section 3, only RFC 3339 format with 'T' separator should be accepted. Remove the space alternative from the regex.
RushiT0122 marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ast.literal_eval() on user configuration input without error handling is risky. If the string is malformed, it will raise a ValueError. Add try-except to handle parsing errors gracefully and log a meaningful error message.
| form_ids = ast.literal_eval(raw_ids) | |
| try: | |
| form_ids = ast.literal_eval(raw_ids) | |
| except (ValueError, SyntaxError) as e: | |
| LOGGER.error(f"Failed to parse 'form_ids' from config: {raw_ids!r}. Error: {e}") | |
| form_ids = [] |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inferring schema from only the first submission is unreliable. If the first submission has null values or missing fields, the schema will be incomplete. Consider iterating through multiple submissions and merging their schemas, or at minimum, document this limitation.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,2 @@ | ||
| from tap_formkeep.streams.submissions import Submissions | ||
|
|
||
| STREAMS = { | ||
| "submissions": Submissions, | ||
| } | ||
|
|
||
| STREAMS = {} |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.