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

Should be able to instantiate Query without a connection #390

Open
maxalbert opened this issue Feb 15, 2019 · 3 comments · May be fixed by #3128
Open

Should be able to instantiate Query without a connection #390

maxalbert opened this issue Feb 15, 2019 · 3 comments · May be fixed by #3128
Labels
FlowMachine Issues related to FlowMachine refactoring

Comments

@maxalbert
Copy link
Contributor

Currently the code in Query.__init__() raises an error if no valid connection to flowdb exists.

This has various disadvantages. For example, it makes it necessary to create connections in all tests that use a flowmachine query, even if they don't require running it. A more subtle downside is that it encourages to write tests in a more integrationy style (typically running against the database and checking the result, which slows down the test suite) rather than encouraging a design which allows for more unit-style tests.

It would be beneficial if Query objects could be instantiated without requiring an active connection to flowdb (e.g. by passing a dummy connection).

@maxalbert maxalbert added FlowMachine Issues related to FlowMachine refactoring labels Feb 15, 2019
@greenape
Copy link
Member

Definitely. Historical reason for this is that in some cases, the query needs to check against FlowDB to know if there's any chance it can be successfully run (e.g. are there missing dates), or in a few cases, to require another query to be written as a table (e.g. Random). Obviously one can either pass in the connection to init for those cases, or add a secondary pre-flight checks method that does this.

@greenape
Copy link
Member

Closed via #1999

@greenape greenape linked a pull request Oct 13, 2020 that will close this issue
8 tasks
@greenape
Copy link
Member

I'm reopening this because while there's no longer a dependence on Query.connection a connection is still required at init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FlowMachine Issues related to FlowMachine refactoring
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants