-
Notifications
You must be signed in to change notification settings - Fork 10
Feature/sac 27535 frontapp #29
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
Open
romilqlik
wants to merge
14
commits into
master
Choose a base branch
from
feature/SAC-27535-frontapp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9f6165a
[SAC-27536] Frontapp App libary changes
gl-romil 065489b
[SAC-27536] Refactored discovery and sync- logic
gl-romil 92d7bc1
[SAC-27535] Final clean up: discovery fixes,init and sync
gl-romil 9ad2f41
Update discover.py
romilqlik 124270f
Update schemas.py
romilqlik 8bdcb75
Update sync.py
romilqlik 4227888
Update sync.py
romilqlik 6bd3c85
Update __init__.py
romilqlik 257a834
Update __init__.py
romilqlik 80bcb53
Update __init__.py
romilqlik 27e8ae6
Update __init__.py
romilqlik 081b89f
Update __init__.py
romilqlik ba41dcf
Update sync.py
romilqlik d3c8f75
Update test_client.py
romilqlik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,6 @@ tags | |
singer-check-tap-data | ||
state.json | ||
catalog.json | ||
output.json | ||
convert_json_csv.py | ||
notes_frontapp.txt |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import singer | ||
from singer import metadata | ||
from singer.catalog import Catalog, CatalogEntry, Schema | ||
from .schemas import get_schemas | ||
|
||
LOGGER = singer.get_logger() | ||
|
||
|
||
def discover(): | ||
"""Run the discovery mode, prepare the catalog file and return the catalog.""" | ||
schemas, field_metadata = get_schemas() | ||
print("Schemas loaded:", schemas.keys()) | ||
|
||
catalog = Catalog([]) | ||
|
||
for stream_name, schema_dict in schemas.items(): | ||
try: | ||
schema = Schema.from_dict(schema_dict) | ||
mdata = field_metadata[stream_name] | ||
except Exception as err: | ||
LOGGER.error(err) | ||
LOGGER.error(f"stream_name: {stream_name}") | ||
LOGGER.error(f"type schema_dict: {type(schema_dict)}") | ||
raise err | ||
|
||
key_properties = mdata.get((), {}).get("table-key-properties",[]) | ||
|
||
catalog.streams.append( | ||
CatalogEntry( | ||
stream=stream_name, | ||
tap_stream_id=stream_name, | ||
key_properties=key_properties, | ||
schema=schema, | ||
metadata=metadata.to_list(mdata), | ||
) | ||
) | ||
|
||
return catalog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
import singer | ||
from tap_frontapp.streams import sync_selected_streams | ||
from tap_frontapp.schemas import load_and_write_schema, STATIC_SCHEMA_STREAM_IDS | ||
|
||
LOGGER = singer.get_logger() | ||
|
||
|
||
def update_currently_syncing(state, stream_name): | ||
"""Update the currently syncing stream in the Singer state.""" | ||
if not stream_name and singer.get_currently_syncing(state): | ||
del state["currently_syncing"] | ||
else: | ||
singer.set_currently_syncing(state, stream_name) | ||
singer.write_state(state) | ||
|
||
|
||
def sync(atx): | ||
"""Main sync method to process selected streams from FrontApp.""" | ||
|
||
catalog = atx.catalog | ||
state = atx.state | ||
|
||
streams_to_sync = [s.tap_stream_id for s in catalog.get_selected_streams(state)] | ||
LOGGER.info("Selected streams: %s", streams_to_sync) | ||
|
||
last_stream = singer.get_currently_syncing(state) | ||
LOGGER.info("Currently syncing: %s", last_stream) | ||
|
||
for stream_name in STATIC_SCHEMA_STREAM_IDS: | ||
load_and_write_schema(stream_name) | ||
|
||
LOGGER.info("Starting sync of selected streams.") | ||
sync_selected_streams(atx) | ||
LOGGER.info("All selected streams synced successfully.") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
EOF