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

feat: foreign key on delete cascade action testing and samples #910

Merged
merged 14 commits into from Jul 26, 2023

Conversation

asthamohta
Copy link
Contributor

No description provided.

@asthamohta asthamohta requested review from a team as code owners March 13, 2023 12:20
@snippet-bot
Copy link

snippet-bot bot commented Mar 13, 2023

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/python-spanner API. samples Issues that are directly related to samples. labels Mar 13, 2023
def test_create_table_with_foreign_key_delete_cascade(capsys, instance_id, sample_database):
snippets.create_table_with_foreign_key_delete_cascade(instance_id, sample_database.database_id)
out, _ = capsys.readouterr()
assert "Created Customers and ShoppingCarts table with FKShoppingCartsCustomerId" in out

Choose a reason for hiding this comment

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

May be instead of checking the output message we should verify that the table was actually created/ altered by the sample or not ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For IT, yes but for samples we just need the to check if an error is not thrown



@pytest.mark.dependency(name="alter_table_with_foreign_key_delete_cascade",
depends=["create_table_with_foreign_key_delete_cascade"])
Copy link

Choose a reason for hiding this comment

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

Hi, As we are adding Foreign Key Delete Cascade constraint , this should Not depend on sample which has already added the constraints while creating the tables, isn't it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is common in samples to have this dependency to reduce the time to run these



DBAPI_OPERATION_TIMEOUT = 240 # seconds
FKDCA_CUSTOMERS_COLUMNS = ("CustomerId", "CustomerName")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Some places we are using FKADC and other places we are using FKDCA . It will be good to use same terminology everywhere.

tests/_fixtures.py Show resolved Hide resolved
@asthamohta asthamohta enabled auto-merge (squash) July 24, 2023 08:41
@asthamohta asthamohta merged commit 681c8ee into googleapis:main Jul 26, 2023
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. samples Issues that are directly related to samples. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants