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

Multiple Valid SQL Statements, Valid SQL Statement Termination - Parse Error #1278

Open
poorbadger opened this issue Jan 15, 2024 · 4 comments
Labels

Comments

@poorbadger
Copy link

Describe the bug
When attempting to run multiple consecutive SQL commands delimited with a semicolon between commands (eg. SELECT * FROM table1; SELECT * FROM table2;) SQL Tools raises a PARSE_SYNTAX ERROR.

If you run commands line by line (eg. highlight line 1, select Command + e, highlight line 2, select Command + e, etc) the commands execute successfully.

SQL Console Output:
[PARSE_SYNTAX_ERROR] Syntax error at or near 'use': extra input 'use'.(line 2, pos 0)

To Reproduce
Steps to reproduce the behavior:

  1. Goto SQL Tools
  2. Connect to Database
  3. Create new SQL file
  4. Enter multiple valid SQL commands delimited by valid ANSI SQL statement terminator (ie. Semicolon)

Expected behavior
Consecutive valid commands should execute successfully. User shouldn't need to separate commands into multiple SQL files or highlight line by line and execute each validly terminated command manually.

Desktop (please complete the following information):

  • SQLTools Version v0.28.1

  • VS Code Version:
    Version: 1.85.1
    Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
    Date: 2023-12-13T09:48:16.874Z
    Electron: 25.9.7
    ElectronBuildId: 25551756
    Chromium: 114.0.5735.289
    Node.js: 18.15.0
    V8: 11.4.183.29-electron.0
    OS: Darwin arm64 23.1.0

  • OS:Mac

    • Driver:
  • Databricks Driver for SQLTools v 0.4.2

  • Database version: Databricks SQL

Screenshot 2024-01-15 at 2 04 58 PM

== SQL ==
use catalog samples;
use database nyctaxi;
select * from trips LIMIT 10;

@poorbadger
Copy link
Author

Updating with results when commands are highlighted manually and run one at a time.

Screenshot 2024-01-15 at 2 21 06 PM

@poorbadger
Copy link
Author

poorbadger commented Jan 15, 2024

After digging into databricks a little more it looks like the parse error is occurring on their side and being returned to you. Somehow the same commands issued through their web UI work fine. They must be parsing themselves through the UI and issuing commands one by one.

Screenshot 2024-01-15 at 2 29 16 PM Screenshot 2024-01-15 at 2 26 42 PM

@poorbadger
Copy link
Author

Results when running via PyCharm Database Tool - Success
Screenshot 2024-01-15 at 2 37 06 PM

Databricks Logs - most recent error is when running via VSCode SQLTools Extension. Subsequent successful queries were run from PyCharm in one multi statement batch.
Screenshot 2024-01-15 at 2 39 21 PM

@poorbadger poorbadger reopened this Jan 15, 2024
@poorbadger
Copy link
Author

A few other query execution options from PyCharm Database Tool in case it's useful. Notice the execute as separate statement option.
Screenshot 2024-01-15 at 4 42 24 PM
Screenshot 2024-01-15 at 4 42 33 PM

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

No branches or pull requests

1 participant