monosidev/monosi

SQL compilation error: syntax error line 9 at position 4 unexpected 'FROM'.

Closed this issue · 2 comments

version: 0.0.2

when running monosi -c run on the sample snowflake data, after completing and returning 0 metric, 0 failures the following trace is returned:

Traceback (most recent call last):
  File "/Users/annaweber/Code/monosi_dev/.venv/bin/monosi", line 33, in <module>
    sys.exit(load_entry_point('monosi==0.0.1.post1', 'console_scripts', 'monosi')())
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/__main__.py", line 6, in main
    parser.parse(sys.argv)
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/cli.py", line 29, in parse
    getattr(self, args.command)()
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/cli.py", line 53, in run
    task.run()
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/tasks/base.py", line 53, in run
    return self._process_tasks()
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/tasks/run.py", line 21, in _process_tasks
    results = [task.run() for task in self.task_queue]
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/tasks/run.py", line 21, in <listcomp>
    results = [task.run() for task in self.task_queue]
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/tasks/run.py", line 11, in run
    runner.run()
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/runner.py", line 46, in run
    results = self.execute(sql_stmt)
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi/runner.py", line 32, in execute
    results = self.driver.execute_sql(sql)
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/monosi-0.0.1.post1-py3.9.egg/monosi_drivers/snowflake/configuration.py", line 142, in execute_sql
    cs.execute(sql, params)
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/snowflake/connector/cursor.py", line 790, in execute
    Error.errorhandler_wrapper(
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/snowflake/connector/errors.py", line 272, in errorhandler_wrapper
    handed_over = Error.hand_to_other_handler(
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/snowflake/connector/errors.py", line 327, in hand_to_other_handler
    cursor.errorhandler(connection, cursor, error_class, error_value)
  File "/Users/annaweber/Code/monosi_dev/.venv/lib/python3.9/site-packages/snowflake/connector/errors.py", line 206, in default_errorhandler
    raise error_class(
snowflake.connector.errors.ProgrammingError: 001003 (42000): SQL compilation error:
syntax error line 9 at position 4 unexpected 'FROM'.

It looks like this is happening because we are currently requiring a list of columns and none have been specified. We should validate in the TableMonitor class to check if columns have been specified.

Alternatively, we could figure out where to inject the mechanism to retrieve the columns for the table - though I'm unsure without taking a look where the best time to do so would be.