-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: optimize tables/schema operations (#57)
Closes #29 - disable altering for now until we optimize that better. This was also done in [target-postgres](https://github.com/MeltanoLabs/target-postgres/blob/bfb80d328076acc440ddc98f3f9b14ecb381d0ce/target_postgres/connector.py#L19). I opened #58 to track adding support back in once it efficient. - caches table columns and schemas within a sink object. If a schema or key properties change for a stream then a new sink object is created so this is safe to cache and does not need to be invalidated. - I like the `prepare_schema` method was used with `IF NOT EXISTS` as a quick way to avoid these weird column casing and reserved word errors. Its slow to let it constantly retry creating so I removed it by fixing the `schema_exists` logic to not accidentally try to recreate it again. This required schema names to be conformed before passing to the `prepare_schema` method. - UPDATE: there was an issue with the way schema messages were processed that caused github streams to constantly re-initialize new sinks and drain old ones. For the Squared CI test it was doing this 150+ times for a 1 day set of data. I put in a fix here by overriding `get_sink` to remove `_sdc_` columns before comparing because the existing sink schema has already been post processed at that point and the new incoming schema has not. This should be pushed down to the SDK but for now this worked to get my CI tests down to the original transferwise timing. cc @kgpayne
- Loading branch information
1 parent
13cec6e
commit 5693b6f
Showing
3 changed files
with
117 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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