#!/usr/bin/env python
# Copyright (c) TripleBlind Holdings, Inc. Confidential and Proprietary. All rights reserved.

import tripleblind as tb


raise SystemExit("This script is for reference only.")

tb.initialize()

#############################################################################
# Microsoft SQL Server is a relational database developed by Microsoft.
# TripleBlind data assets can be created on top of this database by defining a
# view of the data using an SQL Query.  Beyond the view, you also need to
# define the route to the database as well as proper credentials to access
# the data.
#
# The values below define a data asset that is linked to your database.

# Address of your Microsoft SQL database
SERVER = "testsqlserver123.database.windows.net"

# The default port for Microsoft SQL is 1433.  This can be customized, if unsure see:
PORT = 1433

# The specific database name within Microsoft SQL
DATABASE_NAME = "SampleDatabase"

# SQL statement which generates the view of data you want to connect as an
# asset.  This can be simple or complex with conditions and calculated fields.
SQL_VIEW = "SELECT CustomerID, FirstName, LastName, Phone FROM SalesLT.Customer;"

#############################################################################

asset1 = tb.asset.MSSQLDatabase.create(
    host=SERVER,
    port=PORT,
    database=DATABASE_NAME,
    username="dbuser1",
    password="dbpassword1",
    query=SQL_VIEW,
    name="MSSQL Demo DB",
    desc="MSSQL Database Asset",
    is_discoverable=True,
)
