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 alembic test #102

Closed
wants to merge 2 commits into from
Closed

Conversation

jrcastro2
Copy link

@jrcastro2 jrcastro2 commented Jun 6, 2023

Copy link
Member

@alejandromumo alejandromumo left a comment

Choose a reason for hiding this comment

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

Left some questions.
Also checks are failing for isort and black

elif script.down_revision in revision_ids:
down_revision_index = revision_ids.index(script.down_revision)
revision_ids.insert(down_revision_index + 1, script.revision)
elif script.nextrev in revision_ids:
Copy link
Member

Choose a reason for hiding this comment

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

question: is this code reachable? The other two conditions state: if element in collection , elif element not in collection. That should cover all the possibilities?

Copy link
Author

Choose a reason for hiding this comment

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

This covers all the possibilites except for the very first recipe of a branch, which has down_revision = None in that case we need to rely on nextrev.

Copy link
Member

@alejandromumo alejandromumo Jun 7, 2023

Choose a reason for hiding this comment

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

But then if script.down_revision = None, it would enter in the first statement I think

In [2]: a = []

In [3]: None in a
Out[3]: False

In [4]: None not in a
Out[4]: True

Copy link
Member

Choose a reason for hiding this comment

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

follow up on branches and dependencies between branches:

what happens with a recipe that has down_revision = '1234' and depends_on = '5678'? It should run:5678 -> 1234 -> current.

module_scripts.append(script)
revision_ids = _sort_revision_ids(module_scripts)
for revision_id in revision_ids:
ext.alembic.upgrade(target=revision_id)
Copy link
Member

Choose a reason for hiding this comment

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

question: what happens with branches? Two distinct alembic branches might have the same depends_on but no down_revision.

Copy link
Author

Choose a reason for hiding this comment

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

Not sure I fully understand the question. We do get all the recipes of the branch we are willing to test, those recipes should always have down_revision (except for the fist recipe of the branch). When executing the upgrade for each recipe, it will execute the recipe and if it has any dependency (depends_on) it will execute it first.

Copy link
Member

Choose a reason for hiding this comment

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

Ok then I think it's up to _sort_revision_ids to actually take into account these branches edge cases and depends_on.

@jrcastro2
Copy link
Author

This is not anymore needed

@jrcastro2 jrcastro2 closed this Jun 9, 2023
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.

Groups membership support
2 participants