wintersrd / pipelinewise-tap-mssql

Pipelinewise tap for Microsoft SQL Server
GNU Affero General Public License v3.0
14 stars 50 forks source link

fix: Schema is not retaining the correct column order #73

Closed mjsqu closed 3 months ago

mjsqu commented 3 months ago

Fixes #62 by refactoring the desired_columns function to use lists instead of sets as they preserve order. List comprehensions are used to filter the lists rather than a loop. Operations such as intersection, difference and union are also replaced with list comprehensions.

Also includes modifications to the existing TestSelectsAppropriateColumns:

Adds new test TestInvalidInclusion which tests that an exception is raised when an inclusion value of "invalid" is supplied, which is not one of the valid values:

mjsqu commented 3 months ago

For my own future reference, I could have more quickly run my updated tests by doing:

poetry install
poetry run pytest tests/test_tap_mssql.py -k TestSelects -v
poetry run pytest tests/test_tap_mssql.py -k TestInvalid -v

Running all tests requires the build of a database (as supplied by the docker image in the tox.ini) - but the functionality I was testing didn't require a connection to SQL Server.

mjsqu commented 3 months ago

These are done:

I ran poetry lock --no-update but there are no changes as I have made no updates to dependencies

s7clarke10 commented 3 months ago

Thank you for adding the version updates. Change approved. Thank you.