SQLite3 EditorThis extension allows you to edit SQLite 3 files without having to write SQL queries. IMPORTANT: This extension requires Python >=3.6 compiled with SQLite >=3.37.0 (fully supported) or >=3.8.8 (partially supported). The extension will notify you if the requirements are not met. FeaturesTable of Contents
Spreadsheet GUI for Browsing and Editing DataThis extension offers several features for editing SQLite databases intuitively:
These features are not present in other VSCode extensions for SQLite, such as alexcvzz/SQLite and SQLite Viewer.
Advanced Query EditorAlthough this extension was initially created to fill the need for an extension that could intuitively edit SQLite databases using a GUI, it also comes with an advanced query editor that supports auto-completion, syntax highlighting, hover information, signature help, and syntax validation. TODO: The image above is from a version before the syntax validator was added. To access the query editor, click the "Custom Query" button. The line comment at the first line of the query editor indicates which database the editor is connected to, and should not be deleted, or the query editor will be disconnected from the database. The comment serves the purpose of enabling the user to save the content of the query editor as a file and reuse it later. There are two ways to execute statements in the query editor:
The extension checks the database's mtime every second to automatically reload the table, which may result in a slight delay between the execution of a statement and the updates to the table. Syntax ValidationThe extension finds syntax errors by preparing (or compiling) each statement in the editor and catching compilation errors. However, some PRAGMAs do their work when the statement is prepared [1], so we do not check them for syntax errors. [1] "Some PRAGMA statements do ..." in https://www.sqlite.org/lang_explain.html#explain_operates_at_run_time_not_at_prepare_time Document FormattingYou can format queries by selecting "Format Document" in the command palette or by pressing Shift+Alt+F. This feature employs sql-formatter to format queries.
You can adjust formatting options with the configurations under Common Table Expression (CTE) SupportTo make it easier to create a complex query involving CTEs, the extension adds buttons that enable you to display the output of each CTE. In-Memory DatabasesSometimes, you may want to write a SQL query for use in source code with code completions enabled. However, this extension requires a database connection to enable its IDE features. In such cases, you can connect to an in-memory database using Switching TablesYou can switch between tables by clicking a table name in either the editor or the explorer. When the Filtering and Sorting DataThis extension also includes a find widget that enables you to filter records using regex, whole word, and case-sensitivity switches, making data searching faster than using the query editor to write WHERE clauses. To sort records by a specific column, simply click on the column name. You can also sort the table from the context menu on the column name. Multi-SelectionUPDATE and DELETE statements support multi-selection. To select multiple cells, you can either drag over the cells, click a cell with the alt key pressed, or press the Shift + Arrow keys while a cell is selected.
Table Schema ViewerBy clicking the "Schema" button located next to the table name, you can view the schema of the table, as well as its indexes and triggers. Diff EditorWhen you open a database from the source control view, you will see a side-by-side comparison of two versions of the database. To display the differences between the two versions, click the "Compare with Local File" button. Depending on the size of the database, it may take several seconds or minutes for the differences to appear. If locking the databases is a problem for your use-case, you should avoid using this feature. Full 64-bit integer supportThis extension is capable of processing 64-bit integers without any loss of information, which is not straightforward in JavaScript, the language used to implement the UI, as its number type only supports 53-bit integers. To prevent any rounding of large integers, we store all integer values as bigints. CSV/JSON/SQL Import/ExportBy clicking the "Other Tools..." button, you can access various features, including CSV, JSON, and SQL imports and exports. These features require you to install the sqlite-utils package. File AssociationsThis extension recognizes Links to Tables or QueriesYou can create links to specific tables or queries using query strings. Note that VSCode's automatic linking, which is enabled by the "editor.links" configuration, may drop query parameters in relative links.
Creating a DatabaseTo create a database, simply create a file with a supported file extension, such as .db, .sqlite, or .sqlite3. The extension will automatically initialize the file as a database if it is empty and has one of the supported extensions. GUI Editors for CREATE TABLE, ALTER TABLE, CREATE INDEX, CREATE TABLE, DROP TABLE, and INSERTTo access the GUI editors for these statements, click the name of the current statement and choose the desired option from the context menu. Displaying and Jumping to the Definition of Foreign KeysYou can display and jump to the definition of foreign keys by hovering your mouse over them and using context menus. Resizing ColumnsYou can resize columns by dragging the right edge of the column header, or by using the "Autofit Column Width" button to adjust the width according to the content. Related ProjectsHere is a comparison table for related projects, as of February 2023. VSCode Extensions | Name | Cross-platform? | Free? | Easy to use (for me)? | Supports many DBMS? | Has a query editor? | Supports in-place editing? | Paging Method *2 | Other comments | |--|--|--|--|--|--|--|--|--| | VSCode + SQLite3 Editor (This project) | ✓ | ✓ | ✓ | x | ✓ | ✓ | ✓ scroll bar | supports syntax validation | | VSCode + SQLite | ✓ | ✓ | x | x | ✓ | x | x pagination | | | VSCode + SQLTools | ✓ | ✓ | x | ✓ | ✓ | x | x pagination | | | VSCode + MySQL | ✓ | x; not all features are free | x | ✓ | - | - | - | | | VSCode + SQLite Viewer | ✓ | ✓ | ✓ | x | x | x | ✓ scroll bar | | Standalone Applications | Name | Cross-platform? | Free? | Easy to use (for me)? | Supports many DBMS? | Has a query editor? | Supports in-place editing? | Paging Method *2 | Other comments | |--|--|--|--|--|--|--|--|--| | VSCode + SQLite3 Editor (This project) | ✓ | ✓ | ✓ | x | ✓ | ✓ | ✓ scroll bar | supports syntax validation | | DbGate | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | x infinite scroll | feature rich | | DBeaver | ✓ | ✓ | x; too many buttons | ✓ | ✓ | ✓ | x infinite scroll | feature rich | | Antares SQL Client | ✓ | ✓ | ✓ | ✓ | x | ✓ | x pagination | | | SQLPad | ✓ | ✓ | - | - | - | - | - | maintenance mode | | Beekeeper Studio | ✓ | x | - | ✓ | ✓ | ✓ | - | | | DB Browser for SQLite | ✓ | ✓ | x; too many buttons | x | ✓ | ✓ | x pagination | | | SQLiteStudio | ✓ | ✓ | x; too many buttons | x | - | - | - | | | SQLiteFlow | x; Mac only | ✓ | - | x | - | - | - | | | sqlectron | ✓ | ✓ | ✓ | ✓ | x | - | | | little-brother/sqlite-gui | x; Windows only | ✓ | - | x | - | - | - | | | SQLPro | x; Mac only | x | - | ✓ | - | - | - | | | SQLiteExpert | x; Windows only | x | - | x | ✓ | ✓ | - | | | Native SQLite Manager | x; Mac only | - | - | x | - | - | - | | | Navicat | ✓ | x | - | ✓ | ✓ | - | - | |
Configurationsqlite3-editor.pythonPathThis extension automatically selects a Python interpreter in the system's PATH that has the highest bundled database version. However, if an unexpected version of Python is selected or if you want to use a Python that is not in the PATH, you can use this setting. The binary specified in this configuration must be either CPython (the standard version available from python.org) or PyPy. The extension does not accept other types of Python or a path to a virtual environment. sqlite3-editor.helperProgramPathSome advanced features require building a helper program to access the SQLite C/C++ interface. This setting is used to set the location of the built program for the extension. sqlite3-editor.maxHistoryEntriesBy default, this extension saves the last 500 SQL queries in ExtensionContext.globalState and you can view it using sqlite3-editor.connectionSetupQueries.driver.{sqlite,duckdb}This configuration specifies the SQL statements that are executed immediately after connecting to a database. The keys are case-sensitive regular expressions used to match the file URI (e.g. This configuration is similar to the "sqlite.setupDatabase" configuration in alexcvzz/sqlite but differs in that it uses regular expressions for path comparison. As this extension uses Python to connect to databases, commands such as For example, to execute
sqlite3-editor.connectionSetupQueries.debugThis configuration allows you to view which setup queries were used. If enabled, the extension displays the URI matched against the regex patterns in connectionSetupQueries and the result of the match for each pattern when an editor is opened. sqlite3-editor.runtimeLoadableExtensions.driver.sqlite3This configuration loads run-time loadable extensions immediately after connecting to a database, using the Most run-time loadable extensions can be loaded with
The keys are case-sensitive regular expressions used to match the file URI, and the values are the list of runtime-loadable extensions to be loaded. In case multiple patterns match the same URI, only the first item will be used. The runtime-loadable extensions are loaded before executing the setup queries specified in For example, to load the
sqlite3-editor.nativeTableSelectorThe drop-down in the top left corner, used to select a table, has performance problems when the number of tables is large (> 1000). To address this issue, this extension displays a notification to recommend enabling this configuration when a large database is opened. When this configuration set to true, mouse clicks on a table name in the top left corner will open a VSCode's quick pick widget instead of the drop-down menu. This configuration provides faster rendering, but it may be less intuitive to use. Monitoring and ReportingError ReportingThis extension displays a "Send error report" button on error notifications. When clicked, it sends the error message with sensitive information removed to the extension's author using Microsoft/vscode-extension-telemetry, or opens a GitHub issue, depending on the user's telemetry settings. If vscode-extension-telemetry is used, the system information (i.e. the "common properties" of Microsoft/vscode-extension-telemetry) will also be included. Keep in mind that the bugs may not be fixed if the reports do not include enough information or the developer is busy, but your help in reporting errors is greatly appreciated. Telemetry DataThis extension collects anonymous telemetry data using Microsoft/vscode-extension-telemetry. The purpose of this telemetry is to:
The following is the list of data collected, and no sensitive or personal information will be collected or transmitted:
The data collected is encrypted and will be deleted after 90 days, which is the default setting in Microsoft Azure Monitor. The data collected will only be used to improve the extension and will not be shared with any third parties. VSCode provides the "telemetry.enableTelemetry" configuration option to control telemetry, and this extension, along with any other extensions using Microsoft/vscode-extension-telemetry, follows this setting. Please note that the telemetry data collected by this extension may change in future releases. |