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

Intercell seeding breaks cell magics #754

Closed
chrispyles opened this issue Dec 26, 2023 · 2 comments · Fixed by #758
Closed

Intercell seeding breaks cell magics #754

chrispyles opened this issue Dec 26, 2023 · 2 comments · Fixed by #758
Labels
bug Something isn't working
Milestone

Comments

@chrispyles
Copy link
Member

For cells that use cell magics, intercell seeding may cause errors that prevent those cells from executing. For example, a cell like

%%sql
-- just run this cell --
SELECT * FROM sqlite_master WHERE type='table';

becomes

np_V8HY0L.random.seed(42)
random.seed(42)
%%sql
-- just run this cell --
SELECT * FROM sqlite_master WHERE type='table';

I think the solution here should be just to not insert intercell seeding code for cells that start with %%.

@chrispyles chrispyles added the bug Something isn't working label Dec 26, 2023
@rohanjha123
Copy link

If there is no intercell seeding for magic cells, would we be able to autograde things like the SQL RAND() functions without having to specify a seed in every RAND() call across multiple cells?

@chrispyles chrispyles added this to the v5.3.0 milestone Dec 28, 2023
@chrispyles
Copy link
Member Author

If there is no intercell seeding for magic cells, would we be able to autograde things like the SQL RAND() functions without having to specify a seed in every RAND() call across multiple cells?

The current implementation of intercell seeding does not support seeding SQL; it only seeds numpy and the built-in random library. So yes, to seed RAND in SQL, you would need to add the seeds yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants