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

Skip explores with no dimensions #101

Merged
merged 3 commits into from
Nov 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions spectacles/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,20 @@ def _query(self, mode: str = "batch") -> List[SqlError]:
tasks = []
for model in self.project.models:
for explore in model.explores:
if mode == "batch" or (mode == "hybrid" and not explore.queried):
logger.debug("Querying one explore at at time")
task = loop.create_task(
self._query_explore(session, model, explore)
)
tasks.append(task)
elif mode == "single" or (mode == "hybrid" and explore.errored):
logger.debug("Querying one dimension at at time")
for dimension in explore.dimensions:
if explore.dimensions:
if mode == "batch" or (mode == "hybrid" and not explore.queried):
logger.debug("Querying one explore at at time")
task = loop.create_task(
self._query_dimension(session, model, explore, dimension)
self._query_explore(session, model, explore)
)
tasks.append(task)
elif mode == "single" or (mode == "hybrid" and explore.errored):
logger.debug("Querying one dimension at at time")
for dimension in explore.dimensions:
task = loop.create_task(
self._query_dimension(session, model, explore, dimension)
)
tasks.append(task)

query_task_ids = list(loop.run_until_complete(asyncio.gather(*tasks)))
loop.run_until_complete(session.close())
Expand Down