Skip to content
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

Add SQL file for SqlServer #165

Merged
merged 9 commits into from
Feb 26, 2025

Conversation

stefanedwards
Copy link
Contributor

@stefanedwards stefanedwards commented Jan 28, 2025

Pull request targets #157 .

Pull request also includes some features for unit testing (an EqualityComparer-class for IDataItem, and an extension for CollectionAssert that can use a custom IEqualityComparer to compare contents of list), moving the TestHelper-class from the Json extension, and finally a code coverage report to the github actions.

The commit from 3dfc61b contains the additional feature for supporting parameterized queries.

@stefanedwards stefanedwards force-pushed the add-query-file branch 2 times, most recently from 2be1d96 to 7ca3cd5 Compare January 28, 2025 12:51
Added unit testing on Cosmos.DataTransfer.Common with coverage.
Moved TestHelper from Cosmos.DataTransfer.JsonExtension.UnitTests to
Cosmos.DataTransfer.Common.UnitTests.
Adds `FilePath` argument to point to a text file with SQL statement,
instead of including the entire SQL statement in the migrationsettings-file.

add: Coverage to SqlServer extension
@markjbrown
Copy link
Collaborator

This feels like something that should get baked in at the core. I would think lots of source extensions would benefit from allowing users to store the query in a file versus putting inline.

@bowencode do you have thoughts on this?

@stefanedwards
Copy link
Contributor Author

stefanedwards commented Feb 22, 2025 via email

@markjbrown
Copy link
Collaborator

I'm unsure which is the best way to do this, but I feel like the more common approach is to have properties that accept either inline text or a file versus explicit properties for each.

As far as the discrepancy between Cosmos and SQL source connectors I suppose I would add a Query property to SQL to unify the two interfaces. I don't know though, this is @bowencode's call.

@stefanedwards
Copy link
Contributor Author

Alright. :)

I'll go for the Query option to cover both a literal statement and a reference to a file, but will await @bowencode's feedback.

@bowencode
Copy link
Collaborator

I don't think there's much difference either way. Neither is really confusing or a burden on the user. The single property adds a little extra logic to run every time but shouldn't be significant.

I don't see any advantage in shared code just to read a file to a string. These are just simple properties that are only superficially similar across different extensions with almost no additional code between reading the property and sending the result into the extension specific code.

@markjbrown
Copy link
Collaborator

Thanks @bowencode, makes sense.

@stefanedwards if you want to just add the property to the SQL extension go for it. Or if this is ready to go, let me know. This PR is out of date with the main branch. Just update. I'll rerun the checks and if good, we can merge.

Thanks.

Copy link
Collaborator

@bowencode bowencode left a comment

Choose a reason for hiding this comment

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

Code looks good and passed all my tests.

@markjbrown markjbrown merged commit be0966d into AzureCosmosDB:main Feb 26, 2025
2 checks passed
@stefanedwards stefanedwards deleted the add-query-file branch February 27, 2025 11:47
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.

3 participants