SQLite3 EditorThis extension allows you to edit SQLite 3 files without having to write SQL queries. Update: Previously this extension required Python, but starting from v1.0.91 it no longer requires Python. Feature OverviewThis extension can be used to 🔴 view and edit database contents, 🟢 view and edit table schema, or 🔵 execute SQL queries. ![]() Most of these features are not present in other VSCode extensions for SQLite, such as alexcvzz/SQLite and SQLite Viewer. Here are some videos of the main features: 🔴 Viewing Database ContentsThis extension uses scrolling instead of pagination for browsing records, by only querying the visible area. The data is automatically reloaded when the table is modified by another process. It also comes with some fancy features, such as conditional formatting, image BLOBs preview, foreign key hover, etc. 🔴 Editing Database ContentsIn addition to simple UPDATEs and INSERTs shown in the recording above, you can bulk-set a value to a selection, delete multiple rows by dragging over row numbers, set a value to a cell in a foreign key column using a dropdown, edit a table via a view, etc. 🟢 Editing Table SchemaIn addition to tables, you can also edit a view's name and definition. 🔵 Executing SQL QueriesThe editor supports auto-completion, syntax highlighting, hover documentation, signature help, and syntax validation. Feature DocumentationThe arrangement of the features listed in this section does not reflect any particular order. Feel free to explore each feature as per your interest. 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. Editing Table Schema - Checking Table SchemaTo view the schema of the active table, click on the "Schema" button located at the top of the editor. This will open a panel displaying the table schema, indexes, and triggers. This feature supports both tables and views. Editing Table Schema - Changing Column DefinitionYou can change the type affinity and the constraints of a column with this feature. Editing Table Schema - Changing Column OrderYou can change the order of table columns by dragging the table header. We've tested this feature extensively, but we won't take any responsibility for possible data loss. Please ensure you check the generated query and/or create a backup before using this feature, especially if you're working with a critical database. Editing Table Schema - Creating a TableYou can access this feature by clicking on the statement at the bottom of the editor, then selecting "CREATE TABLE". The tables that can be created by this feature are limited to simpler ones. To create a table such as ones with GENERATED columns or COLLATE clauses, use the query editor. Editing Table Schema - Creating an IndexYou can access this feature by either clicking the SQL statement at the bottom of the editor, right-clicking the table name in the SELECT statement, or clicking "Schema" then "Index > + Add". Editing Table Schema - Dropping a TableYou can access this feature by either clicking on the SQL statement at the bottom of the editor, or by right-clicking the table name in the SELECT statement, and then selecting "DROP TABLE". Editing Table Schema - Renaming a TableTo rename a table, right-click the table name in the SELECT statement, and then select "Rename Table". File AssociationsThis extension recognizes Importing and Exporting Data in CSV, JSON, or SQLBy 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. This feature pre-fills a command in a terminal. You can check the options the executable takes by using 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 Opening the Database in a Command Line ShellYou can open the database with the command line shell from the "Other Tools > Open in Command Line Shell" menu item when Query Editor - OverviewTo 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 three ways to execute statements in the query editor:
Uncommitted transactions ( 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. Query Editor - 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 Query Editor - Executing a Part of Common Table Expression (CTE)To make it easier to create a complex query involving CTEs, the extension adds buttons that enable you to display the output of each CTE. Query Editor - 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 Table View - Auto ReloadingWhen the 'Auto Reload' button is activated, the editor will automatically refresh the table whenever there are updates. Table View - Conditional FormattingConditional formatting colorizes table cells by their values. You can use this feature by right-clicking a table column then "Colorize (Conditional Formatting)". Table View - 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. Table View - Editing GENERATED ColumnsGENERATED columns can be edited just like any other columns. Committing a change updates the table schema. Table View - 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. Table View - Git-Diff SupportWhen 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. Table View - Group by ColumnYou can group records by a column with this feature. To group a column, right-click on a column header then select "Group by Column". To cancel the grouping, click the icon on the column header. Table View - Inserting Data from CSVYou can insert CSV into an existing table by clicking the SQL statement at the bottom of the editor then selecting "Bulk Insert". This feature inserts CSV data into the table. Each CSV column is encoded as TEXT, but if the table column has a data type (column affinity), SQLite will cast it to the appropriate type. For example, if a column is defined as "column1 INTEGER," then the CSV values in that column will be cast as an integer. Table View - Jumping to a Table or a RowWhen the extension's editor is active, you can use the Go to Table/Row command to navigate to a specific table and/or row. The Ctrl+G keybinding is assigned to this command. Table View - 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 View - 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. Table View - Switching TablesYou can switch between tables by clicking a table name in either the editor or the explorer. When the ConfigurationsNOTE: This document does not cover all of the configuration options. Search "sqlite3-editor" in the VSCode's settings tab for other configurations. 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.connectionSetupQueries.driver.sqliteThis 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. Commands that are available in the SQLite's CLI, including For example, to execute
sqlite3-editor.maxHistoryEntriesBy default, this extension saves the last 500 SQL queries in ExtensionContext.globalState and you can view them using 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.ui.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. Using Non-Standard SQLiteRun-Time Loadable SQLite ExtensionsSpaciaLite
User-Compiled SQLiteSQLite is statically linked to the component of this extension, which is implemented in Rust. You can build it with necessary modifications and then specify the path of the resulting binary in the VSCode settings For instance, if you want to add the compilation flag SQLITE_OMIT_DEPRECATED, you must first install Rust and Git. Then, run the following commands in a terminal. The resulting binary will be located at
Supported Environments
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 if 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. Please note that the telemetry data collected by this extension may change in future releases. |