Destinations
Connect Microsoft SQL Server as a destination
Create a SQL Server service account and connect it to Artie, so your pipeline creates and merges tables in the database and schema you choose.
Create a service account
Run these commands in your SQL Server client as a database admin. They create the login Artie connects with and grant it the permissions to create tables and merge data.
-- Create a service account
CREATE LOGIN artie_transfer WITH PASSWORD = 'PASSWORD';
GO
USE DATABASE_NAME;
GO
CREATE USER artie_transfer FOR LOGIN artie_transfer;
GO
-- If it's not dbo, change the schema name
GRANT ALTER ON SCHEMA::dbo TO artie_transfer;
GO
GRANT CREATE SCHEMA, CREATE TABLE, SELECT, INSERT, UPDATE, DELETE TO artie_transfer;
GOReplace PASSWORD with the login’s password and DATABASE_NAME with the database Artie writes to. Run the GRANT ALTER ON SCHEMA statement once for each schema Artie writes to, including the staging schema if you set one.
Required settings
Enter the connection fields on the destination connector, then choose the database and schema on your pipeline’s destination.
| Field | Default | Value |
|---|---|---|
| Host | None | The host name of your SQL Server instance, for example yourserver.database.windows.net. |
| Port | 1433 | The port SQL Server listens on. |
| Username | None | The service account login, for example artie_transfer. |
| Password | None | The service account password. |
| Database name | None | The database Artie writes to. Select one, or create one from the Dashboard. |
| Schema name | None | The schema Artie writes to. Select one, or create one from the Dashboard. |
Creating a database from the Dashboard runs CREATE DATABASE as the service account, which the script above doesn’t allow. Select an existing database, or grant the login CREATE ANY DATABASE in master. On Azure SQL Database, add the login’s user in master to the dbmanager role instead.
If you set the schema name to public, Artie writes to dbo.
Schema layout
When your source has schemas, choose how Artie maps them. Pipeline setup labels the options One schema and Multiple schemas; pipeline settings label them Write to one schema and Write to multiple schemas.
- One schema sends every table to the schema in Schema name.
- Multiple schemas sends each table to a schema named after its source schema, with an optional prefix. Schema name isn’t used. Without a prefix, tables from a source schema named
publicland indbo.
For how Artie names tables in each layout, see Destination table naming.
SSH tunnel
To reach a SQL Server instance in a private network, connect through an SSH tunnel.
Advanced settings
These destination settings apply to SQL Server. All three are off by default.
| Setting | Label in pipeline settings | What it does |
|---|---|---|
| Staging schema | Put staging tables in a different schema | Creates Artie’s temporary staging tables in a separate schema. |
| Create missing schemas | Dynamically create namespaces | Creates destination schemas that don’t exist, instead of failing verification on them. |
| Raw binary | Write raw binary values | Writes binary values as raw bytes in VARBINARY(MAX) columns instead of Base64 strings. |
What Artie creates
Artie creates each destination table that doesn’t exist. When Artie merges data, it bulk copies the rows into a temporary staging table, then merges them into the destination table.
Staging tables sit in the destination table’s schema. When you set a staging schema, merges stage their tables there instead. Their names follow TABLE___artie_SUFFIX_EXPIRY. SUFFIX is 5 random characters, and EXPIRY is a Unix timestamp 6 hours after creation.
Column types
Artie creates columns with these SQL Server types.
| Source value | SQL Server type |
|---|---|
| Integer | bigint |
| Float or double | float |
| Decimal with precision up to 38 | NUMERIC(p, s) |
| Decimal with precision over 38, or no precision | VARCHAR(MAX) |
| Boolean | BIT |
| String or UUID | VARCHAR(n) when the source column has a length, otherwise VARCHAR(MAX) |
| JSON object, array, or interval | NVARCHAR(MAX) |
| Binary | Base64 in a string column, or VARBINARY(MAX) with Raw binary on |
| Date | DATE |
| Time | TIME |
| Timestamp without time zone | datetime2 |
| Timestamp with time zone | datetimeoffset |
String primary key columns are capped at VARCHAR(900), and binary primary key columns at VARBINARY(900).
Non-ASCII text in VARCHAR columns
Artie bulk copies VARCHAR values as UTF-8 bytes. A VARCHAR column with a non-UTF-8 collation reads those bytes as other characters, and counts the value as longer than it is. To avoid this, Artie stages most VARCHAR columns as NVARCHAR, and SQL Server converts the values when it writes the table.
These VARCHAR columns still receive UTF-8 bytes:
- Primary key columns
- Columns with a Japanese, Chinese or Korean collation
- Columns whose collation Artie doesn’t know yet
NVARCHAR columns and VARCHAR columns with a _UTF8 collation aren’t affected.
Tables you create
Artie loads into tables you create yourself and keeps their column types. It reads these SQL Server types:
| Category | Types |
|---|---|
| Text | char, varchar, nchar, nvarchar, text, ntext, xml, uniqueidentifier |
| Binary | binary, varbinary, image |
| Numeric | tinyint, smallint, int, bigint, decimal, numeric, money, smallmoney, float, real, bit |
| Date and time | date, time, datetime, datetime2, smalldatetime, datetimeoffset |
| Spatial | geography, geometry |
A table with a column of any other type fails to load with the error unsupported data type.
Some of these types load differently:
nchar,nvarcharandntextcolumns are staged asNVARCHAR.xmlcolumns are staged asNVARCHAR(MAX), and SQL Server converts the values to XML when Artie writes the table. SQL Server parsesNVARCHARvalues as UTF-16, so a value whose XML declaration names an encoding other than a 2-byte Unicode one, such asencoding="UTF-8", fails to convert. Artie doesn’t remove the declaration.uniqueidentifier,money,smallmoney,geographyandgeometrycolumns are loaded through a staging table, and SQL Server converts the values. Spatial values from sources other than SQL Server are converted withSTGeomFromWKB.- In merges,
IDENTITYcolumns take the source’s values on insert, and Artie leaves them out of updates. Appends, such as history mode, leave them out, so SQL Server assigns them. SQL Server also fills anIDENTITYcolumn the source doesn’t have.
Next steps
- Tune flush rules for a transactional destination.
- Review schema evolution to see how Artie adds and drops columns.
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.