MS SQL Server and the data.world Collector
Introduction
Note
The latest version of the Collector is 2.129. To view the release notes for this version and all previous versions, please go here.
The data.world Collector harvests metadata from your source system. Please read over the data.world Collector FAQ to familiarize yourself with the Collector.
Permissions
The account used to authenticate needs to read the information schema of the databases about which it is collecting metadata. It does not need read access to the data within the tables.
What is cataloged
The information cataloged by the collector includes:
Lineage MS SQL Server
Setting up pre-requisites for running the collector
Make sure that the machine from where you are running the collector meets the following hardware and software requirements.
Item | Requirement |
---|---|
Hardware | |
RAM | 8 GB |
CPU | 2 Ghz processor |
Software | |
Docker | Click here to get Docker. |
Java Runtime Environment | OpenJDK 17 is supported and available here. |
data.world specific objects | |
Dataset | You must have a ddw-catalogs (or other) dataset set up to hold your catalog files when you are done running the collector. |
Generating the command or YAML file
This section walks you through the process of generating the command or YAML file for running the collector from Windows or Linux or MAC OS.
On the Organization profile page, go to the Settings tab > Metadata collectors section.
Click the Help me set up a collector button.
On the On-prem collector setup prerequisites screen, read the pre-requisites and click Next.
On the On which platform will this collector execute? screen, select if you will be running the collector on Windows or Mac OS or Linux. This will determine the format of the YAML and CLI command that is generated in the end. Click Next.
On the Choose metadata collector type you would like to setup screen, select SQL Server. Click Next.
On the Configure a new on premises Microsoft SQLServer Collector screen, set the following properties and click Next.
Table 2.Field name
Corresponding parameter name
Description
Required?
data.world API token
-t= <apiToken>
--api-token= <apiToken>
The Creating and managing service accounts to use for authentication. Default is to use an environment variable named DW_AUTH_TOKEN.
Yes
Output Directory
-o= <outputDir>
--output= <outputDir>
The output directory into which any catalog files should be written.
Yes
Collection Name
-n= <catalogName>
-n= <catalogName>
The name of the collection where the collector output will be stored.
Yes
Automatic upload location
--upload-location= <uploadLocation>
The dataset to which the catalog is to be uploaded. You can specify a simple dataset name to upload to that dataset within the organization's account, or [account/dataset] to upload to a dataset in some other account.
Yes
data.world API host
-H= <apiHost>
--api-host= <apiHost>
The host for the data.world API. NOTE: This parameter is required for single-tenant installations only. For example, "api.8bank.data.world" where "8bank" is the name of the single-tenant install.)
Yes
(for single-tenant installations)
On the next screen, set the following properties and click Next.
Table 3.Field name
Corresponding parameter name
Description
Required
Server
-s= <server>
--server= <server>
The hostname of the database server to connect to.
Yes
Server port
-p= <port>
--port= <port>
The port of the database server (if not the default).
No
Database
-d= <database>
--database= <database>
The name of the database to connect to.
Yes
Database Id
-D= <databseid>
--database-id= <databaseId>
A unique identifier for this database - will be used to generate the ID for the database (this is optional, you only need to provide this if the database name used for the connection is not sufficiently unique to completely identify the database)
No
Schemas to collect
Select from one of the following options: Collect all schema, Specify which schema to collect
Yes
Collect all schema
-A, --all-schemas
Catalog all schemas to which the user has access.
Yes
(if --schema is not set)
Specify which schema to collect
-S= <databaseSchema>
--schema= <databaseSchema>
Select this option and then specify the names of the database schema to be catalog.
Yes
(if --all-schemas is not set)
Information schema
--include-information-schema
when
--all-schemas
is specified, include the database's Information Schema in catalog collection (ignored if--all-schemas
is not specified).No
Username
-u= <user>
--user= <user>
The username to use to make the JDBC connection.
Yes
Password
-P= <password>
--password=<password>
Specify this option to provide the password for the database on the command line.
Yes
Server environment
-e= <environment>
--environment= <environment>
if your provided server name is localhost, use this to give a friendly name to the environment in which your database server runs. it helps differentiate it from other environments.
No
On the next screen, set the following optional properties and click Next.
Table 4.Field name
Corresponding parameter name
Description
Required?
Disable lineage collection
--disable-lineage-collection
Skip harvesting of intra-database lineage metadata.
No
Collect extended properties
--collect-extended-properties
Harvest information about extended properties from SQL Server.
No
Enable column statistics collection
--enable-column-statistics
Enable harvesting of column statistics (this is optional, and may greatly increase collector run time)
No
Enable sample string values collection
--sample-string-values
Enable sampling and storage of sample values for columns with string values.
No
Target sample size for Profiling
--target-sample-size=<targetSampleSize>
Target for number of rows to sample from tables.
No
JDBC Properties
--jdbc-property=<driverProperties>
JDBC driver properties to pass through to driver connection, as name=value. Separate the name=value pairs with a semicolon (;). For example, property1=value1;property2=value2
No
On the Finalize your Microsoft SQLServer Collector configuration screen, you are notified about the environment variables and directories you need to setup for running the collector. Select if you want to generate Configuration file ( YAML) or Command line arguments (CLI). Click Next..
Important
You must ensure that you have set up these environment variables and directories before you run the collector.
The next screen gives you an option to download the YAML configuration file or copy the CLI command. Click Done. If you are generated a YAML file, click Next.
Sample YAML file:
The Microsoft SQLServer command screen gives you the command to use for running the collector using the YAML file.
You will notice that the YAML/CLI has following additional parameters that are automatically set for you.
Table 5.Parameter name
Details
Required?
-a= <agent>
--agent= <agent>
--account= <agent>
The ID for the data.world account into which you will load this catalog - this is used to generate the namespace for any URIs generated.
Yes
--site= <site>
This parameter should be set only for Private instances. Do not set it for public instances and single-tenant installations. Required for private instance installations.
Yes (required for private instance installations)
-L
--no-log-upload
Do not upload the log of the Collector run to the organization account's catalogs dataset or to another location specified with
--upload-location
(ignored if--upload
not specified)Yes
dwcc: <CollectorVersion>
The version of the collector you want to use (For example,
datadotworld/dwcc:2.113)
Yes
Add following additional parameter to test run the collector.
--dry-run If specified, the collector does not actually harvest any metadata, but just checks the database connection parameters provided by the user and reports success or failure at connecting.
Add following additional parameter for private instances.
-z=<postProcessSparq>, --post-process-sparql=<postProcessSparq> : A file containing a SPARQL query to execute to transform the catalog graph emitted by the collector.
Verifying environment variables and directories
Verify that you have set up all the required environment variables that were identified by the Collector Wizard before running the collector. Alternatively, you can set these credentials in a credential vault and use a script to retrieve those credentials.
Verify that you have set up all the required directories that were identified by the Collector Wizard.
Running the collector
Important
Before you begin running the collector make sure you have the correct version of collectors downloaded and available.
Running collector using YAML file
Go to the server where you have setup docker to run the collector.
Make sure you have download the correct version of collectors. This version should match the version of the collector specified in the YAML/CLI generated from the collector wizard.
Place the YAML file generated from the Collector wizard to the correct directory.
From the command line, run the command generated from the application for executing the YAML file.
Caution
Note that is just a sample command for showing the syntax. You must generate the command specific to your setup from the application UI.
docker run -it --rm --mount type=bind,source=${HOME}/dwcc,target=/dwcc-output \ --mount type=bind,source=${HOME}/dwcc,target=${HOME}/dwcc --mount type=bind,source=${HOME}/dwcc-drivers,target=/usr/src/dwcc-config/lib \ -e DW_AUTH_TOKEN=${DW_AUTH_TOKEN} -e DW_SQLSERVER_PASSWORD=${DW_SQLSERVER_PASSWORD} \ datadotworld/dwcc:2.124 --config-file=/dwcc-output/config-sqlserver.yml
The collector automatically uploads the file to the specified dataset and you can also find the output at the location you specified while running the collector.
At a later point, if you download a newer version of the collector from docker, you can edit the collector version in the generated command to run the collector with the newer version.
Running collector without the YAML file
Go to the server where you have setup docker to run the collector.
Make sure you have download the version of collectors from here.
From the command line, run the command generated from the application. Here is a sample command.
Caution
Note that is just a sample command for showing the syntax. You must generate the command specific to your setup from the application UI.
docker run -it --rm --mount type=bind,source=${HOME}/dwcc,target=/dwcc-output \ --mount type=bind,source=${HOME}/dwcc,target=${HOME}/dwcc --mount type=bind,source=${HOME}/dwcc-drivers,target=/usr/src/dwcc-config/lib \ datadotworld/dwcc:2.124 catalog-sqlserver --agent=8bank-catalog-sources \ --site=solutions --no-log-upload=false --upload=true --api-token=${DW_AUTH_TOKEN} \ --output=/dwcc-output --name=8bank-catalog-sources-collection \ --upload-location=ddw-catalogs --server=8bank_server --database=8bank_database \ --all-schemas=true --include-information-schema=false --user=8bank_user \ --password=${DW_SQLSERVER_PASSWORD} --disable-lineage-collection=true \ --collect-extended-properties=true --enable-column-statistics=false \ --sample-string-values=true --target-sample-size=10
The collector automatically uploads the file to the specified dataset and you can also find the output at the location you specified while running the collector.
At a later point, if you download a newer version of collector from docker, you can edit the collector version in the generated command to run the collector with the newer version.
Handling custom certificates
If the target data instance has a custom SSL certificate, we recommend extending our Docker image and installing the custom cert like this (where ./ca.der is the name and location of the cert file).
Dockerfile:
FROM datadotworld/dwcc:<collector_version>
ADD ./ca.der ca.der
RUN keytool -importcert -alias startssl -cacerts -storepass changeit -noprompt -file ca.der
Important
Do not forget to replace <collector_version> in datadotworld/dwcc:<collector_version> with the version of the Collector you want to use (for example, datadotworld/dwcc:2.126)
.
Then, in the directory with that Dockerfile:
docker build -t dwcc-cert .
Note
The command needs to be all lower case, and there must be a dot (.) supplied to reference the current directory.
Finally, change the docker run command to use dwcc-cert instead of dwcc. Here is an example command for cataloging Tableau with a custom SSL certificate:
docker run -it --rm --mount type=bind,source=/tmp,target=/dwcc-output \ --mount type=bind,source=/tmp,target=/app/log dwcc-cert \ catalog-tableau --tableau-api-base-url <baseUrl> \ --tableau-password <password> --tableau-username <username> \ -a <account> -n <catalogName> -o "/dwcc-output"
Collector runtime and troubleshooting
The catalog collector may run in several seconds to many minutes depending on the size and complexity of the system being crawled. If the catalog collector runs without issues, you should see no output on the terminal, but a new file that matching *.dwec.ttl should be in the directory you specified for the output. If there was an issue connecting or running the catalog collector, there will be either a stack trace or a *.log file. Both of those can be sent to support to investigate if the errors are not clear. A list of common issues and problems encountered when running the collectors is available here.
Automating updates to your metadata catalog
Keep your metadata catalog up to date using cron, your Docker container, or your automation tool of choice to run the catalog collector on a regular basis. Considerations for how often to schedule include:
Frequency of changes to the schema
Business criticality of up-to-date data
For organizations with schemas that change often and where surfacing the latest data is business critical, daily may be appropriate. For those with schemas that do not change often and which are less critical, weekly or even monthly may make sense. Consult your data.world representative for more tailored recommendations on how best to optimize your catalog collector processes.