MSSQL Data Virtualization Wizard

This VS Code extension provides a step-by-step wizard to connect external SQL Server databases via PolyBase and automatically generate CREATE EXTERNAL TABLE statements.
Note: As confirmed by Microsoft in this discussion, "As of now, there isn't a direct replacement for the Virtualize Data extension in VS Code, neither we have planned to support this feature in the MSSQL extension." This community extension fills that gap.
Changelog
- 0.5.1: BugFix Oracle provider #69
- 0.5.0: Migrate to the authenticated MSSQL Shared Connections API v1 (
getSharedConnectionsApi(1)), replacing retired connection APIs #55. Add support for IRIS InterSystems
#65. Serval platform updates and update to VSCode 1.146.
- 0.4.1: Maintenance release — dependency and compatibility updates (TypeScript 7.0.2, VS Code 1.136, @types/vscode 1.136, vscode-mssql v1.45.1), updated typings and npm audit fixes
- 0.4.0: Improved SQL formatting — refactored
CREATE EXTERNAL TABLE column definitions to display one column per line with proper indentation; dependency updates (VS Code 1.125, @types/vscode 1.125, vscode-mssql v1.43.0)
- 0.3.3: Maintenance release — dependency updates (VS Code 1.120, @types/vscode 1.120, vscode-mssql typings v1.42.2)
- 0.3.2: TypeScript 6.0.2 upgrade with tsconfig moduleResolution fix, updated @types/vscode to 1.116.0
- 0.3.1: Maintenance release with dependency and compatibility updates (VS Code 1.110 support, @types/vscode 1.110, underscore and undici updates)
- 0.3.0: Add support for Oracle external datasources + update vscode-mssql typing to 1.40
- 0.2.1: Add functionality to interrupt the wizard.
- 0.2.0: Add support for MariaDB / MySQL external datasources
- 0.1.0: Support for SQL Server external datasources
Features
The wizard executes the following steps:
- Select Connection: Choose a SQL Server database connection
- Select Database: Choose the target database where external tables will be created
- Select Provider Type: Choose SQL Server, MariaDB/MySQL, Oracle, or InterSystems IRIS discovery mode
- For Oracle, enter the service name used as the first component of remote table locations
- For IRIS, enter the namespace used as the first component of remote table locations
- Select Destination Schema: Choose the schema for created external tables (default:
dbo)
- Select External Data Source: Choose an existing PolyBase external data source
- Discover External Databases: Select one or more external databases/schemas to connect to
- Select Tables/Views: Choose which tables and views you want to virtualize
- Generate Scripts: The wizard automatically detects the schemas of external objects and generates corresponding
CREATE EXTERNAL TABLE statements
- Review Scripts: The generated DDL is displayed in a new SQL editor tab
- Cleanup: All temporary discovery tables are automatically removed
Usage
To start the wizard:
- Press CTRL + Shift + P (or CMD + Shift + P on macOS) to open the Command Palette
- Type and select "Virtualize Data Wizard"
- Follow the step-by-step wizard to generate your external table scripts
The wizard asks VS Code for permission to access MSSQL shared connections. Select a saved MSSQL connection or the active editor's connection, then choose the target database. Access can be revoked from VS Code's Accounts menu.
To create a connection, choose New MSSQL connection, finish creating it in MSSQL, then run Virtualize Data Wizard again. The wizard reports an upgrade requirement if the installed MSSQL extension does not expose getSharedConnectionsApi(1); it does not fall back to retired APIs.
How It Works
The wizard leverages PolyBase schema detection:
- For each selected table or view, the wizard sends a dummy
CREATE EXTERNAL TABLE statement to SQL Server
- SQL Server returns an error message containing the actual schema of the external object
- The wizard parses this detected schema and generates a correct
CREATE EXTERNAL TABLE statement
- After detection, all temporary external tables are automatically cleaned up
Prerequisites
- VS Code 1.70.0 or higher
- MSSQL extension (ms-mssql.mssql) with Shared Connections API v1 (
IExtension.getSharedConnectionsApi(1)) - this is a required dependency. This extension manages database connections. For setup instructions, see the vscode-mssql repository
- SQL Server 2016 or higher with PolyBase installed and configured. For PolyBase setup instructions, see the PolyBase guide
- Existing PolyBase external data source configured in the target database. For external data source configuration, see CREATE EXTERNAL DATA SOURCE
- Network access from your SQL Server to the external database
Required SQL Server Privileges
The user account must have the following permissions in the target database:
- CREATE EXTERNAL TABLE: Required to create external tables
- ALTER SCHEMA: Required if creating external tables in non-dbo schemas
- SELECT on
sys.external_data_sources: Required to discover available external data sources
- SELECT on
sys.schemas, sys.tables, and sys.views: Required to query metadata of external objects (these are queried via temporary external tables)
- ALTER DATABASE: May be required if PolyBase is not yet enabled on the database
Minimal recommended role: db_owner or custom role with the above permissions.
Supported External Data Sources
- SQL Server external data sources via PolyBase (using
sqlserver:// location)
- MariaDB/MySQL external data sources via PolyBase + ODBC (using
odbc:// location)
- Oracle external data sources via PolyBase (using
oracle:// location, see Oracle PolyBase configuration)
- InterSystems IRIS external data sources via PolyBase and the InterSystems ODBC driver (using
odbc:// location)
Other PolyBase sources (Azure Blob Storage, Hadoop, etc.) are not supported at this time.
InterSystems IRIS Notes
Install the InterSystems IRIS ODBC driver on the SQL Server PolyBase host and configure an ODBC external data source with the appropriate driver and DATABASE connection option. The wizard prompts for the IRIS namespace, discovers schemas through INFORMATION_SCHEMA, and generates remote locations in namespace.schema.table form. For example, the supplied working location SomeSchema.SomeSchema.SomeTable is generated when both the namespace and schema are SomeSchema. Confirm the namespace and schema parts against the target IRIS configuration before executing generated scripts.
Oracle-Specific Notes
When working with Oracle external data sources:
- Use the built-in
oracle:// connection string format (e.g., oracle://hostname:1521)
- The wizard prompts for the Oracle service name. PolyBase uses it to connect, so it must be a service registered with the Oracle listener (for example
FREEPDB1 or ORCLPDB1). It is not the Oracle username. Query SELECT SYS_CONTEXT('USERENV','SERVICE_NAME') FROM dual; from a working Oracle session to find it
- In Oracle, a schema equals a user. The wizard discovers schemas by querying
SYS.ALL_USERS
- System schemas (SYS, SYSTEM, etc.) are automatically filtered out
- Oracle table names are typically uppercase (e.g.,
AVIATION.AIRPLANE)
- The
LOCATION in generated external tables uses the format: [SERVICE_NAME].SCHEMA.TABLE (e.g., [FREE].AVIATION.AIRPLANE)
Example Oracle external data source creation:
CREATE DATABASE SCOPED CREDENTIAL OracleCredential
WITH IDENTITY = 'SYSTEM', SECRET = 'YourPassword';
CREATE EXTERNAL DATA SOURCE Oracle_Aviation
WITH (
LOCATION = 'oracle://localhost:1521',
CREDENTIAL = OracleCredential
);
Test Infrastructure
See tst/README.md for a Docker/Podman compose environment with:
- SQL Server (PolyBase enabled)
- Sample SQL Server database (Movies)
- MariaDB instance (Books database)
- Oracle Free instance (Aviation database)
Note on Temporary Tables
During the discovery process, the wizard creates temporary external tables (with prefix DVW_):
For SQL Server:
DVW_sys_databases_*: For discovering available external databases
DVW_*_sys_tables_*: For discovering tables in external databases
DVW_*_sys_views_*: For discovering views in external databases
DVW_*_sys_schemas_*: For discovering schema information
For MariaDB/MySQL:
DVW_information_schema_schemata_*: For discovering available databases
DVW_*_information_schema_tables_*: For discovering tables and views
For Oracle:
DVW_ALL_USERS_*: For discovering available schemas/users
DVW_*_ALL_TABLES_*: For discovering tables in schemas
For InterSystems IRIS:
DVW_IRIS_SCHEMATA_*: For discovering schemas in the selected namespace
DVW_IRIS_*_TABLES_*: For discovering tables and views
These tables are automatically removed at the end of the process. They are temporary and exist solely to support the discovery process.