Skip to main content

Microsoft SQL Server

Microsoft SQL Server is a database server for storing and retrieving data.

User Impersonation

The Microsoft SQL Server username provided in the connection configuration is the default username when running queries. When queries are run against Microsoft SQL Server in Dremio, users use the privileges associated with the Microsoft SQL Server username and run queries under that username.

You can change this default in Dremio by enabling user impersonation in the Advanced Options, which allows users to run queries under their own usernames and restricts their access. For example, user_1 can run queries as user_1 rather than sqlsvr_svc. Before enabling user impersonation, some setup is required in Microsoft SQL Server to allow one user to impersonate another user. The username of the user in Dremio must be the same as their username in Microsoft SQL Server, and the user must be able to connect through the Microsoft SQL Server username.

To set up user impersonation, follow these steps:

  1. Ensure the user's username in Microsoft SQL Server matches their username in Dremio. If the usernames do not match, modify one of the usernames or create a new user account with a matching username.

  2. Run a GRANT IMPERSONATE command in Microsoft SQL Server to allow the user to connect through their Microsoft SQL Server username:

    Example of granting impersonate privilege in Microsoft SQL Server
    GRANT IMPERSONATE ON USER::testuser1 TO proxyuser;

    In this example, the user can log in as testuser1 in Dremio and in Microsoft SQL Server, and they can connect through the proxyuser. The proxyuser is the Microsoft SQL Server username provided in the connection configuration.

  3. Log in to Dremio as a member of the ADMIN role.

  4. Follow the steps for Connect to Microsoft SQL Server using the Microsoft SQL Server username proxyuser and enable User Impersonation in the Advanced Options.

  5. Grant privileges to the user.

Now that you have enabled user impersonation, a user who logs in to Dremio with their username can access Microsoft SQL Server according to their privileges. The user can also run queries against Microsoft SQL Server under their username.

Connect to Microsoft SQL Server

  1. In the Dremio console, click Add Data on the Home page.
  2. In the Add Data dialog, select Microsoft SQL Server.
  3. Configure the connection using the sections below, then click Save.

General

The General tab contains the required fields to create a Microsoft SQL Server connection.

Perform these steps in the General tab:

  1. In the General tab, for Name, enter a name for the connection. The name cannot include the following special characters: /, :, [, or ].
  2. For Host, enter the Microsoft SQL Server hostname.
  3. For Port, enter the Microsoft SQL Server port number. The default port is 1433.
  4. (Optional) For Database, enter the Microsoft SQL Server database name.
  5. (Optional) For Encrypt connection, enable encrypted connections to Microsoft SQL Server using SSL.
  6. For Authentication, Master Authentication is the default and the only option. Provide the username and password of a master database user with permissions to read required objects:
    • For Username, enter your Microsoft SQL Server database username.
    • For Password, enter your Microsoft SQL Server database password.

Advanced Options

Click Advanced Options in the sidebar. All advanced options are optional.

Advanced OptionDescription
Show only the initial database used for connectingIf selected, hides the other databases that the credential has access to.
Record fetch sizeNumber of records to fetch at once. Set to 0 (zero) to have Dremio automatically decide. The default record fetch size is 200.
Maximum idle connectionsThe total number of connections allowed to be idle at a given time. The default maximum idle connections is 8.
Connection idle time (s)The amount of time (in seconds) allowed for a connection to remain idle before the connection is terminated. The default connection idle time is 60 seconds.
Query timeout (s)The amount of time (in seconds) allowed to wait for the results of a query. If this time expires, the connection being used is returned to an idle state.
Enable user impersonationSelect the checkbox to allow users to run queries using their credentials rather than those of the user specified in the Authentication configuration. Some setup is required in Microsoft SQL Server to allow one user to impersonate another user. Read User Impersonation for more information.
EncryptionVerify Server Certificate is enabled. Add an SSL/TLS server certificate distinguished name in the text box.
Connection PropertiesCustom key value pairs for the connection. To add a connection property, click Add property and add the property name and value.

Reflection Refresh

The Reflection Refresh tab in the sidebar allows you to set time intervals for Reflections to refresh or expire.

Metadata

You can configure settings to refresh metadata and handle datasets. Click Metadata in the sidebar.

You can configure Dataset Handling and Metadata Refresh parameters.

Dataset Handling

These are the Dataset Handling parameters. All Dataset Handling parameters are optional.

ParameterDescription
Remove dataset definitions if underlying data is unavailableBy default, Dremio removes dataset definitions if underlying data is unavailable. Useful when files are temporarily deleted and added back in the same location with new sets of files.

Metadata Refresh

These are the Metadata Refresh parameters:

  • Dataset Discovery: The refresh interval for fetching top-level object names such as databases and tables. Set the time interval using this parameter.

    ParameterDescription
    (Optional) Fetch everyYou can choose to set the frequency to fetch object names in minutes, hours, days, or weeks. The default frequency to fetch object names is 1 hour.
  • Dataset Details: The metadata that Dremio needs for query planning such as information required for fields, types, shards, statistics, and locality. These are the parameters to fetch the dataset information. All Dataset Details parameters are optional.

    ParameterDescription
    Fetch modeYou can choose to fetch only from queried datasets, which is set by default. Dremio updates details for previously queried objects. Fetching from all datasets is deprecated.
    Fetch everyYou can choose to set the frequency to fetch dataset details in minutes, hours, days, or weeks. The default frequency to fetch dataset details is 1 hour.
    Expire afterYou can choose to set the expiry time of dataset details in minutes, hours, days, or weeks. The default expiry time of dataset details is 3 hours.

Privileges

This connection inherits privileges from Project settings. To grant specific users or roles additional privileges in this connection:

  1. Enter the username or role name that you want to grant access to and click the Add to Privileges button. The added user or role is displayed in the USERS/ROLES table.
  2. For the users or roles in the USERS/ROLES table, toggle the checkmark for each privilege you want to grant on the Dremio source that is being created.
  3. Click Save after setting the configuration.

See Privileges for additional information about privileges.

Edit a Microsoft SQL Server Connection

  1. On the Open Catalog page, under Connections, right-click the connection and select Settings.
  2. Update the connection configuration as needed.
  3. Click Save.

Delete a Microsoft SQL Server Connection

  1. On the Open Catalog page, under Connections, right-click the connection and select Delete.
  2. Click Delete to confirm.

You can use AWS PrivateLink to connect Dremio to a customer-owned Microsoft SQL Server instance hosted in AWS through an interface VPC endpoint. Use these steps when Dremio has enabled private source connectivity for your organization.

This configuration uses the VPC endpoint service model. In this model, you create a VPC endpoint service backed by a Network Load Balancer (NLB) in your AWS account, and Dremio creates an interface VPC endpoint to that service from Dremio infrastructure.

Prerequisites

Before you start, confirm that your Microsoft SQL Server instance and the Dremio organization are ready for private connectivity.

Confirm all of the following:

  • Your Dremio organization has private source connectivity enabled.
  • Your Microsoft SQL Server instance is hosted in AWS.
  • Your Dremio organization is in a region that supports private source connectivity. See Regions.
  • Your Microsoft SQL Server instance is in the same AWS Region as your Dremio organization.
  • You can create a Network Load Balancer and VPC endpoint service in the AWS account that hosts your Microsoft SQL Server instance.

Review the AWS documentation for creating a VPC endpoint service and managing endpoint service permissions before you proceed.

note

PrivateLink endpoints created by Dremio are available only to projects that already exist in the organization when Dremio creates the endpoints. To enable a newly created project to use an existing PrivateLink endpoint, contact Dremio Support.

Complete these steps in order. You perform the AWS setup steps in the account that hosts your Microsoft SQL Server instance. Dremio Support notifies you when the PrivateLink connection has been created.

Step 1: Create a VPC Endpoint Service

Create an AWS PrivateLink producer service in the AWS account that hosts your Microsoft SQL Server instance.

  1. Create a Network Load Balancer (NLB) in the same VPC as your Microsoft SQL Server instance. Configure the NLB to forward traffic to your Microsoft SQL Server instance on port 1433.
  2. Create a VPC endpoint service backed by the NLB. Record the service name, which has the format com.amazonaws.vpce.<region>.vpce-svc-....
  3. Confirm that the endpoint service is in the same AWS Region as your Dremio organization.

Step 2: Authorize the Dremio AWS Account

Grant the Dremio AWS account permission to create an interface endpoint to your VPC endpoint service. Use the account ARN that matches your Dremio organization's region.

Dremio RegionDremio AWS Account ARN
US (us-west-2, us-east-1, us-east-2)arn:aws:iam::602951639670:root
EMEA (eu-central-1, eu-west-1)arn:aws:iam::067773914317:root
Authorize the Dremio AWS account
aws ec2 modify-vpc-endpoint-service-permissions \
--service-id vpce-svc-xxxxxxxx \
--add-allowed-principals '["<DREMIO_ACCOUNT_ARN>"]'

Replace vpce-svc-xxxxxxxx with your endpoint service ID and <DREMIO_ACCOUNT_ARN> with the ARN for your Dremio region.

Step 3: Open a Dremio Support Request

Open a request with Dremio Support to start the private source connectivity workflow. Include the Dremio organization and project that need access to Microsoft SQL Server.

  1. Go to the Dremio Support Portal.
  2. Request private source connectivity for Microsoft SQL Server through AWS PrivateLink.
  3. Provide your Dremio Organization ID.
  4. Include the following details:
ValueDescription
VPC endpoint service nameThe service name in the format com.amazonaws.vpce.<region>.vpce-svc-....
AWS RegionThe AWS Region where your endpoint service is hosted.
Microsoft SQL Server hostnameThe hostname Dremio must use for TLS/SNI verification when connecting.
PortThe port your Microsoft SQL Server instance listens on (default: 1433).

Step 4: Accept the Endpoint Connection (if required)

If your VPC endpoint service requires manual acceptance, you must accept Dremio's endpoint connection request. Dremio Support will notify you when the request is ready to accept.

Accept the endpoint connection request
# Only required if your endpoint service has manual acceptance enabled
aws ec2 accept-vpc-endpoint-connections \
--service-id vpce-svc-xxxxxxxx \
--vpc-endpoint-ids vpce-xxxxxxxx

Replace vpce-xxxxxxxx with the endpoint ID provided by Dremio Support.

Step 5: Configure the Microsoft SQL Server Source in Dremio

After Dremio Support confirms that the PrivateLink connection has been created, configure the Microsoft SQL Server source in Dremio. For source configuration steps, see Connect to Microsoft SQL Server.

Coordinate removal with Dremio before deleting your VPC endpoint service. Dremio must remove the interface endpoint and private source configuration from Dremio infrastructure.

  1. Open a Dremio Support request to remove the Microsoft SQL Server private source connection.
  2. Wait for Dremio to confirm that the interface endpoint is deleted.
  3. Delete the VPC endpoint service and NLB from your AWS account.

Predicate Pushdowns

Dremio offloads these operations to Microsoft SQL Server:

*, +, -, /, %
<, <=, <>, =, >, >=, !=
AND, NOT, OR, ||
ABS
ACOS
ADD_MONTHS
ASIN
ATAN
ATAN2
AVG
CAST
CEIL
CEILING
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
COS
COT
DATE_ADD
DATE_SUB
DATE_TRUNC_DAY
DATE_TRUNC_HOUR
DATE_TRUNC_MINUTE
DATE_TRUNC_MONTH
DATE_TRUNC_YEAR
DEGREES
E
EXP
EXTRACT_DAY
EXTRACT_DOW
EXTRACT_DOY
EXTRACT_HOUR
EXTRACT_MINUTE
EXTRACT_MONTH
EXTRACT_QUARTER
EXTRACT_SECOND
EXTRACT_WEEK
EXTRACT_YEAR
FLOOR
IS DISTINCT FROM
IS NOT DISTINCT FROM
IS NOT NULL
IS NULL
LAST_DAY
LCASE
LEFT
LENGTH
LIKE
LN
LOCATE
LOG
LOG10
LOWER
LPAD
LTRIM
MAX
MEDIAN
MIN
MOD
MONTH
PERCENT_CONT
PERCENT_DISC
PI
POSITION
POW
POWER
RADIANS
RAND
REPLACE
REVERSE
RIGHT
ROUND
RPAD
RTRIM
SIGN
SIN
SQRT
SUBSTR
SUBSTRING
SUM
TAN
TIMESTAMPADD_DAY
TIMESTAMPADD_HOUR
TIMESTAMPADD_MINUTE
TIMESTAMPADD_MONTH
TIMESTAMPADD_QUARTER
TIMESTAMPADD_SECOND
TIMESTAMPADD_YEAR
TIMESTAMPDIFF_DAY
TIMESTAMPDIFF_HOUR
TIMESTAMPDIFF_MINUTE
TIMESTAMPDIFF_MONTH
TIMESTAMPDIFF_QUARTER
TIMESTAMPDIFF_SECOND
TIMESTAMPDIFF_WEEK
TIMESTAMPDIFF_YEAR
TO_DATE
TRIM
TRUNC
TRUNCATE
UCASE
UPPER
YEAR

note

Since Microsoft SQL Server has no Boolean type, project operations that contain SQL expressions which evaluate to true or false (e.g., SELECT username, friends > 0), and filter operations that include Boolean literals in a filter (e.g., WHERE currentAccount = true) cannot be executed as pushdowns.

Data Type Map

Dremio supports SQL Server data types, as shown in the following table which provides the mappings from SQL Server to Dremio data types. If there are additional SQL Server types not listed in the table, then those types are not supported in Dremio.

SQL Server Data TypeDremio Type
BIGINT IDENTITYBIGINT
BIGINTBIGINT
BINARYVARBINARY
BITBOOLEAN
CHARVARCHAR
DATEDATE
DATETIMETIMESTAMP
DATETIME2TIMESTAMP
DECIMALDECIMAL
DECIMAL() IDENTITYDECIMAL
FLOATDOUBLE
IMAGEVARBINARY
INT IDENTITYINTEGER
INTINTEGER
MONEYDOUBLE
NCHARVARCHAR
NTEXTVARCHAR
NUMERICDECIMAL
NUMERIC() IDENTITYDECIMAL
NVARCHARVARCHAR
REALFLOAT
SMALLDATETIMETIMESTAMP
SMALLINT IDENTITYINTEGER
SMALLINTINTEGER
SMALLMONEYDOUBLE
SYSNAMEVARCHAR
TEXTVARCHAR
TIMETIME
TINYINT IDENTITYINTEGER
TINYINTINTEGER
UNIQUEIDENTIFIERVARBINARY
VARBINARYVARBINARY
VARCHARVARCHAR