Repository navigation
Introducing SQL support in Positron #17156
Pinned
samclark2015
announced in
Announcements
Replies: 3 comments 2 replies
Missing auto-complete for duckdb when not connected to connection paneFor me auto-complete only works when the connection pane has a connection to my duckdb file (green light in the pane) but then execution doesn't work as you note. When the duckdb connection pane connection is closed I can execute the sql via ggsql extension but no auto-complete. |
1 reply
|
Have you tried SQL support and loved it? Or do you have some ideas to make it better? The Positron team wants to hear your feedback directly. Book some time to talk more here: pos.it/positronfeedback |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Until now, a
.sqlfile in Positron was treated as plain text, with no editor features like completions or diagnostics, and to run a query, you had to use a tool like dbplyr in R or sqlalchemy in Python. Native SQL support has been one of our most requested features, since 2024 (#7233). Starting with Positron 2026.11, Positron now knows which database you wrote a SQL file against, and uses that to complete, check, and run it.Note
SQL support is experimental and off by default. To try it, turn on the
sql.enabledsetting. You don't need to reload.How to get started and send feedback
Each file has a connection
SQL support builds on the Data Connections pane. Positron ties every
.sqlfile to one of your connections. The status bar shows which one (hover it for the dialect). Click it to pick a different connection, or go back to Automatic, which follows whichever connection is open.Positron remembers the choice per file, including across renames and Save As. When you reopen the file later, Positron reconnects its database for you. To turn that off, for example for a connection that prompts for credentials or a warehouse that bills you for waking up, turn off the
sql.connectOnOpensetting.We tie each file to a single connection deliberately. You write a query against one database. Completing against every open connection gives you suggestions and errors from databases the query never touches.
Completions
Completions come from your connection's actual schema:
FROMandJOININSERTcolumn list orUPDATE ... SETwarehouse.sales.only lists tables in that catalog and schemaSo you can stop switching over to the Data Connections pane to check whether it was
customer_idorcust_id.Diagnostics and hovers
If you misspell a table or column, you get a warning in the editor before the query runs. Positron flags syntax errors too. It doesn't flag names your query defines itself, like aliases and CTEs.
Hover a name to see a column's type or a table's columns, and Cmd/Ctrl+click it to jump to that table in the Data Connections pane.
Completions, hovers, and warnings also work in
{sql}cells in Quarto documents, using whichever connection is open. Running statements with Cmd+Enter works in.sqlfiles only.Dialects
Positron picks the dialect from the connection's driver: DuckDB, PostgreSQL, SQLite, Snowflake, Databricks, BigQuery, Redshift, MySQL, and others. Quoting, string escapes, comments, and keywords follow that database's rules. If it picks the wrong one, set the
sql.dialectsetting.Running statements
Cmd/Ctrl+Enter works the same way it does in R and Python: it runs the statement under the cursor and moves to the next one. If you have text selected, it runs the selection.
Statements run in a ggsql console connected to the file's database. Positron reuses a console that's already connected to it, or starts one and connects it. Positron sends your SQL as-is, not wrapped in R or Python. Since it's ggsql, you can also add a plot to the end of a query (
SELECT ... VISUALISE x, y DRAW line) and it shows up in the Plots pane.Important
Running SQL requires the ggsql extension. It works with DuckDB, SQLite, MotherDuck, PostgreSQL, Redshift, and ODBC connections. PostgreSQL and Redshift go through ODBC, so you also need that database's ODBC driver installed. Everything else in this post works with any connection in the Data Connections pane.
How it works
There's no language server. Positron parses SQL with
datafusion-sqlparser-rs, compiled to WebAssembly and running inside Positron. There's no separate process or Python interpreter to start, and it's fast enough to keep up as you type.Known limitations
ASOF JOIN, for example). If you run into this, you can turn off thesql.diagnostics.enabledsetting, and please let us know.Try it out
We want SQL in Positron to work as well as R and Python do, and we need your feedback to get there. To try it, follow these steps:
Turn on the
sql.enabledsetting: in Settings (Cmd+,on macOS,Ctrl+,on Windows/Linux), search for SQL and select SQL: Enabled, or add this to yoursettings.json:Add a database in the Data Connections pane.
Open a
.sqlfile.To run statements, install the ggsql extension. Positron offers to install it the first time you run a statement without it.
Then tell us what you run into, including the small stuff:
Reply here or open an issue. It helps a lot to include the database you're connected to and the SQL involved (or a screenshot).
Thanks!
All reactions