Repository navigation
GL Work - #7
GL Work#7
Conversation
|
Hi @romilqlik, thanks for your contribution! In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. |
38d99dd to
01c5ee7
Compare
| 'pytz==2018.4', | ||
| 'singer-python==5.1.5', | ||
| 'backoff==1.3.2', | ||
| 'asn1crypto==1.5.1', |
There was a problem hiding this comment.
Please check if this is whitelisted dependancy.
There was a problem hiding this comment.
Romil - This has been discussed with Rutuja. Kindly confirm if it's whitelisted.
There was a problem hiding this comment.
I would like wait until dependency is approved since we may have to update the existing implementation if not approved.
| result = Schema(inclusion=inclusion) | ||
|
|
||
| if data_type == 'boolean': | ||
| if data_type in ['boolean']: |
There was a problem hiding this comment.
if data_type in ['boolean']
This seems un-necessary for checking with a single item in a list, is this faster in comparison to if data_type == 'boolean' ?
There was a problem hiding this comment.
If we want to make this more clear and concise, this is how we can write it.
STRING_SCHEMA = {'type': ['null', 'string']}
NUMBER_SCHEMA = {'type': ['null', 'number']}
DATETIME_SCHEMA = {'type': ['null', 'string'], 'format': 'date-time'}
SCHEMA_MAPPING = {
'boolean': {'type': ['null', 'boolean']},
'number': NUMBER_SCHEMA,
'real': NUMBER_SCHEMA,
'float': NUMBER_SCHEMA,
'fixed': NUMBER_SCHEMA,
'integer': NUMBER_SCHEMA,
'numeric': NUMBER_SCHEMA,
'text': STRING_SCHEMA,
'string': STRING_SCHEMA,
'timestamp_ntz': DATETIME_SCHEMA,
'datetime': DATETIME_SCHEMA,
'date': DATETIME_SCHEMA,
'variant': STRING_SCHEMA,
'array': STRING_SCHEMA,
'object': STRING_SCHEMA,
}
def schema_for_column(col, inclusion='available'):
"""datatype checking for columns"""
schema_kwargs = SCHEMA_MAPPING.get(col.data_type.lower())
if schema_kwargs:
return Schema(**schema_kwargs, inclusion=inclusion)
return Schema(None, inclusion='unsupported', description=f'Unsupported column type {col.data_type}')There was a problem hiding this comment.
Romil - this has been taken care of.
…th test_connection.py as per the feedback
| """Maps Snowflake data types to Singer schema definitions.""" | ||
| STRING_SCHEMA = {'type': ['null', 'string']} | ||
| NUMBER_SCHEMA = {'type': ['null', 'number']} | ||
| DATETIME_SCHEMA = {'type': ['null', 'string'], 'format': 'date-time'} | ||
|
|
||
| SCHEMA_MAPPING = { | ||
| 'boolean': {'type': ['null', 'boolean']}, | ||
| 'number': NUMBER_SCHEMA, | ||
| 'real': NUMBER_SCHEMA, | ||
| 'float': NUMBER_SCHEMA, | ||
| 'fixed': NUMBER_SCHEMA, | ||
| 'integer': NUMBER_SCHEMA, | ||
| 'numeric': NUMBER_SCHEMA, | ||
| 'text': STRING_SCHEMA, | ||
| 'string': STRING_SCHEMA, | ||
| 'timestamp_ntz': DATETIME_SCHEMA, | ||
| 'datetime': DATETIME_SCHEMA, | ||
| 'date': DATETIME_SCHEMA, | ||
| 'variant': STRING_SCHEMA, | ||
| 'array': STRING_SCHEMA, | ||
| 'object': STRING_SCHEMA, | ||
| } |
There was a problem hiding this comment.
These should ideally be outside the function definition to avoid multiple re-initialization of the SCHEMA_MAPPING and SCHEMA's.
There was a problem hiding this comment.
Romil - this has been taken care of.
| with metrics.job_timer('sync_table') as timer: | ||
| timer.tags['table'] = catalog_entry.table | ||
| sync_incremental.sync_table(con, catalog_entry, state, columns) | ||
| #sync_incremental.sync_table(con, catalog_entry, state, columns) |
There was a problem hiding this comment.
Remove this redundant comment.
|
|
||
| from singer import get_logger, metadata | ||
| from utils import get_test_connection, ensure_test_table | ||
| from utils import get_test_connection, _ensure_test_table # correct import |
There was a problem hiding this comment.
| from utils import get_test_connection, _ensure_test_table # correct import | |
| from utils import get_test_connection, _ensure_test_table |
RushiT0122
left a comment
There was a problem hiding this comment.
Left some minor comments. Also please update backlog ticket details of TODO unittests work in the PR description.
| install_requires=[ | ||
| 'snowflake-connector-python==1.6.3', | ||
| 'snowflake-connector-python==3.15.0', | ||
| # https://github.com/snowflakedb/snowflake-connector-python/pull/208 |
There was a problem hiding this comment.
This comment was related to asn1crypto dependancy which we have removed in this PR so this is redundant now, please remove this. Not holding the PR approval for this.
There was a problem hiding this comment.
Removed outdated comment related to asn1crypto.
|
|
||
| @nottest | ||
| def ensure_test_table(con, table_spec): | ||
| @nottest |
There was a problem hiding this comment.
Since we renamed method, I think we don't need @nottest annotation.
There was a problem hiding this comment.
Either revert renaming or remove annotation.
|
@romilqlik I am not holding the PR but since we are not fixing tests in this PR, we should revert all test related changes. |
Hello Rushikesh, I have reverted all the test related. |
…ty and orchestration support
…ty and orchestration support
…olve non-discoverable field error
Description of Changes
SAC-27712 -
Manual QA Steps
Risks
Minor risk if replication key is missing or schema format doesn't match.
Rollback Steps
Revert the PR merge if needed.