$ show Xemptuous/sqlua.nvim
SQLua.nvim is a Neovim plugin that transforms the editor into a SQL IDE. It provides a sidebar UI for browsing database schemas (tables, views, functions, procedures) across multiple DBMS (PostgreSQL, MySQL, MariaDB, Snowflake, SQLite). Connections are configured via a JSON file with JDBC-like URLs. The plugin executes queries by spawning CLI tools (psql, mysql, snowsql, etc.) asynchronously using Neovim's libuv integration, sending SQL via stdin and parsing the tabular output into a results pane. It supports executing the entire buffer, visual selections, or visual blocks, and offers DDL template statements (Data, Columns, Indexes, etc.) that generate queries on click. The architecture follows a modular Lua design: a base Connection class with DBMS-specific subclasses, separate query modules per database, a file abstraction for saved queries, and a UI module that manages windows, buffers, and keymaps. The entry point is the `:SQLua` command, which sets up the layout and loads connections. The plugin relies solely on Neovim 0.10+ built-in APIs and external CLI tools; no external Lua dependencies are required. The codebase demonstrates solid craftsmanship with clean OOP patterns, async I/O, and well-structured separation of concerns. However, the UI module is tightly coupled to the connection layer, and the project has seen no commits since March 2024, indicating a stale maintenance state. The core utility functions, particularly the JDBC URL parser in utils.lua, are self-contained and could be reused in other Lua projects.
The LLM identified 1 files worth highlighting for reuse:
Contains a well-crafted `parse_jdbc` function that parses JDBC connection URLs into a structured table, handling user/password, host, port, database, IPv6 addresses, and query parameters. It is a pure function with no dependencies on Neovim or other internal modules, making it easily extractable into any Lua project. Also includes other utility functions like `pairsByKeys` for sorted table iteration and `splitString`, but the JDBC parser is the standout reusable component.