Skip to content

GL Work - #7

Merged
dsprayberry merged 62 commits into
masterfrom
gl-master
Jul 30, 2025
Merged

dsprayberry merged 62 commits into
masterfrom
gl-master

Conversation

@romilqlik

@romilqlik romilqlik commented Jun 11, 2025 •

Copy link
Copy Markdown
Contributor

Description of Changes

SAC-27712 -

  • updated init.py
  • Auto detect replication keys
  • Mark all valid fields and streams
  • Add date time format for time fields
  • updated incremental.py to handle filtering and bookmarks correctly

Manual QA Steps

  • Discovery: Running
  • Sync: Tested end to end, data fetched
  • Unit Tests: Removed
  • CI status: Removed (Will take care in the Bug)
  • Verified successful sync and state updates for sample test table.

Risks

Minor risk if replication key is missing or schema format doesn't match.

Rollback Steps

Revert the PR merge if needed.

@singer-bot

Copy link
Copy Markdown

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.

@mittal-tushar mittal-tushar changed the title SAC-27712: updated detup.py with latest dependencies SAC-27712: updated setup.py with latest dependencies Jun 11, 2025
@romilqlik
romilqlik force-pushed the gl-master branch 5 times, most recently from 38d99dd to 01c5ee7 Compare June 16, 2025 06:43
Comment thread setup.py Outdated
'pytz==2018.4',
'singer-python==5.1.5',
'backoff==1.3.2',
'asn1crypto==1.5.1',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if this is whitelisted dependancy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Romil - This has been discussed with Rutuja. Kindly confirm if it's whitelisted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like wait until dependency is approved since we may have to update the existing implementation if not approved.

Comment thread tap_amplitude/__init__.py Outdated
result = Schema(inclusion=inclusion)

if data_type == 'boolean':
if data_type in ['boolean']:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Romil - this has been taken care of.

Comment thread tap_amplitude/__init__.py Outdated
Comment on lines +31 to +52
"""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,
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should ideally be outside the function definition to avoid multiple re-initialization of the SCHEMA_MAPPING and SCHEMA's.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Romil - this has been taken care of.

Comment thread tap_amplitude/__init__.py Outdated
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this redundant comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Done

Comment thread tests/test_discovery.py Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from utils import get_test_connection, _ensure_test_table # correct import
from utils import get_test_connection, _ensure_test_table

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Done

@RushiT0122 RushiT0122 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments. Also please update backlog ticket details of TODO unittests work in the PR description.

Comment thread setup.py Outdated
install_requires=[
'snowflake-connector-python==1.6.3',
'snowflake-connector-python==3.15.0',
# https://github.com/snowflakedb/snowflake-connector-python/pull/208

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@romilqlik romilqlik Jul 1, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed outdated comment related to asn1crypto.

Comment thread tests/utils.py Outdated

@nottest
def ensure_test_table(con, table_spec):
@nottest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we renamed method, I think we don't need @nottest annotation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either revert renaming or remove annotation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed @nottest annotation.

@RushiT0122

Copy link
Copy Markdown
Contributor

@romilqlik I am not holding the PR but since we are not fixing tests in this PR, we should revert all test related changes.

@romilqlik

Copy link
Copy Markdown
Contributor Author

@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.

@vishalp-dev
vishalp-dev self-requested a review July 2, 2025 12:04
@dsprayberry
dsprayberry merged commit 2c67a1c into master Jul 30, 2025
@dsprayberry
dsprayberry deleted the gl-master branch July 30, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants