KevinGG commented on a change in pull request #15647:
URL: https://github.com/apache/beam/pull/15647#discussion_r721805404
##########
File path: sdks/python/apache_beam/runners/interactive/sql/utils.py
##########
@@ -77,21 +86,23 @@ def find_pcolls(
if verbose:
_LOGGER.info('Found PCollections used in the magic: %s.', found)
_LOGGER.info('Collecting data...')
- for name, pcoll in found.items():
- try:
- _ = ib.collect(pcoll)
- except (KeyboardInterrupt, SystemExit):
- raise
- except:
- _LOGGER.error(
- 'Cannot collect data for PCollection %s. Please make sure the '
- 'PCollections queried in the sql "%s" are all from a single '
- 'pipeline using an InteractiveRunner. Make sure there is no '
- 'ambiguity, for example, same named PCollections from multiple '
- 'pipelines or notebook re-executions.',
- name,
- sql)
- raise
+ if run:
+ from apache_beam.runners.interactive import interactive_beam as ib
+ for name, pcoll in found.items():
+ try:
+ _ = ib.collect(pcoll)
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except:
+ _LOGGER.error(
+ 'Cannot collect data for PCollection %s. Please make sure the '
+ 'PCollections queried in the sql "%s" are all from a single '
+ 'pipeline using an InteractiveRunner. Make sure there is no '
+ 'ambiguity, for example, same named PCollections from multiple '
+ 'pipelines or notebook re-executions.',
+ name,
+ sql)
+ raise
Review comment:
Agreed. Move it to the main body of the beam_sql magic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]