import_table_from_url
Import data from a remote URL into an existing Data Warehouse table using COPY INTO. Supports CSV and Parquet files, with options to fail, append, or truncate.
Instructions
Load data into an existing Data Warehouse table via COPY INTO from a remote URL.
The target table must already exist and have a compatible schema.
For auto-create with schema inference from local files, use the CLI
tables load --file --create command instead.
if_exists controls behaviour when the table already exists:
"fail"(default): raise an error if the table already exists, or if it does not exist (the table must be created first with create_empty_table or create_table)."append": load rows into the existing table without modification. Raises an error if the table does not exist."truncate": TRUNCATE the existing table, then load, both inside a single transaction so a failed load leaves the existing rows intact (atomic replace). RequiresFABRIC_MCP_ALLOW_DESTRUCTIVE=1. Raises an error if the table does not exist."replace": not supported for remote URLs (schema inference requires downloading the file). Use"truncate"to keep the current schema, or download locally and use the CLI with--create --if-exists replace.
Supported file types: CSV, PARQUET. JSON remote URLs require
downloading and converting locally first; use the CLI tables load
command for local files (including JSON).
For OneLake or same-tenant URLs, no credential is needed. For secured
external URLs supply credential_type and the appropriate
secret/identity values.
CAUTION: truncate is permanently destructive.
Confirm the source URL and target table before calling.
Note: secret / identity values are accepted but are NEVER logged
or included in any debug output.
Args:
workspace: Workspace name or GUID.
item: Warehouse name or GUID. SQL Analytics Endpoints are rejected.
qualified_name: Dot-separated qualified table name, e.g. dbo.sales.
url: Source URL (OneLake DFS URL or external Azure Blob URL).
file_type: CSV or PARQUET.
if_exists: Policy when the target table already exists.
credential_type: Credential type for the source URL.
secret: Credential secret (not logged).
identity: Identity for managed-identity or service-principal.
delimiter: CSV column delimiter.
has_header: Whether the CSV file has a header row.
encoding: CSV file encoding.
field_quote: CSV field-quote character.
row_terminator: CSV row terminator.
max_errors: Maximum errors before aborting.
rejected_row_location: URL for rejected-row output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| item | Yes | ||
| secret | No | Credential secret (SAS token, client secret, or account key). NEVER log or echo this value. | |
| encoding | No | CSV file encoding (e.g. 'UTF8', 'UTF8BOM'). | |
| identity | No | Identity value for managed-identity or service-principal credential types. | |
| delimiter | No | CSV column delimiter (e.g. ',', '\t'). | |
| file_type | Yes | File type. JSON is not supported for remote URLs; download and convert locally first. | |
| if_exists | No | What to do when the target table exists or is absent. 'fail': error if the table already exists, or if it does not exist (default). 'append': load into the existing table; error if the table is absent. 'truncate': TRUNCATE then load (destructive). 'replace': DROP + recreate from inferred schema, then load (destructive). | fail |
| workspace | Yes | ||
| has_header | No | When True, the first CSV row is a header and is skipped. | |
| max_errors | No | Maximum number of errors before aborting. | |
| field_quote | No | CSV field-quote character. | |
| qualified_name | Yes | ||
| row_terminator | No | CSV row terminator (e.g. '\n', '\r\n'). | |
| credential_type | No | Credential type for secured external URLs. Use 'none' for OneLake or public URLs. | none |
| rejected_row_location | No | URL to write rejected rows to. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||