Microsoft SQL Server
Create a Microsoft SQL Server connector with its real config fields, and understand the managed connection-test behavior for SQL Server before you onboard data.
This page creates a saved mssql connector with its real configuration fields and explains exactly how the engine handles a SQL Server connection so you know what to expect at each step. An mssql connector is a SQLAlchemy-based connection built on the mssql+pyodbc driver.
Prerequisites: an API key and a base URL (see Authentication), and SQL Server credentials — a host, a database, a user, and that user's password. Use https://api.algenta.ai for Algenta cloud, or your own origin such as http://localhost:8000 for a self-hosted deployment.
Set your credentials
Export your API key and base URL, and keep your SQL Server password in its own variable so it never appears inline in shell history.
export ALGENTA_API_KEY="$ALGENTA_API_KEY"
export ALGENTA_BASE_URL="https://api.algenta.ai"
export MSSQL_PASSWORD="$MSSQL_PASSWORD"Verify the variables are set:
echo "${ALGENTA_API_KEY:?set ALGENTA_API_KEY}" >/dev/null && echo "key present"
echo "$ALGENTA_BASE_URL"
echo "${MSSQL_PASSWORD:?set MSSQL_PASSWORD}" >/dev/null && echo "password present"Expected result: three lines print without error — key present, your base URL, and password present. If any line errors, export the missing variable before continuing.
Confirm the engine accepts mssql
Ask the engine which connector types it supports and confirm mssql is in the list.
curl -s "$ALGENTA_BASE_URL/v1/connectors/types" \
-H "Authorization: Bearer $ALGENTA_API_KEY"Expected result: a JSON object with a types array that includes "mssql", for example {"types": ["mssql", "mysql", "postgres", ...]}.
Create the SQL Server connector
POST /v1/connectors stores the connection name, type, and credentials, and returns the connector with status: "untested". Supply the discrete host, port, database, user, and password fields, and optionally override the ODBC driver.
curl -s -X POST "$ALGENTA_BASE_URL/v1/connectors" \
-H "Authorization: Bearer $ALGENTA_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"App SQL Server\",
\"connector_type\": \"mssql\",
\"config\": {
\"host\": \"db.internal\",
\"port\": 1433,
\"database\": \"app\",
\"user\": \"reader\",
\"password\": \"$MSSQL_PASSWORD\",
\"driver\": \"ODBC Driver 18 for SQL Server\"
}
}"If you already have a DSN, pass it as connection_string instead of the discrete fields:
curl -s -X POST "$ALGENTA_BASE_URL/v1/connectors" \
-H "Authorization: Bearer $ALGENTA_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"App SQL Server\",
\"connector_type\": \"mssql\",
\"config\": {
\"connection_string\": \"mssql+pyodbc://reader:$MSSQL_PASSWORD@db.internal:1433/app?driver=ODBC+Driver+18+for+SQL+Server\"
}
}"Capture the returned id:
export CONNECTOR_ID="$CONNECTOR_ID"Expected result: a 201 response with the connector id, "connector_type": "mssql", and "status": "untested". Credentials are encrypted at rest — the connector object never returns your config back to you, only its name, type, status, and last test result.
Verify the credentials from your own client
Because the engine does not run a managed test for SQL Server, confirm the same host, database, user, and password work from a client you control. This is the check the engine would otherwise perform.
sqlcmd -S db.internal,1433 -d app -U reader -P "$MSSQL_PASSWORD" -Q "SELECT 1;"Expected result: sqlcmd prints a single-row result for SELECT 1. If it errors, fix the host, port, database, user, password, or driver before relying on the saved connector.
Other ways to create the connector
The same endpoint backs the de CLI and the Python SDK.
de connectors create connector.json # POST /v1/connectors from a JSON body
de connectors list # GET /v1/connectorsimport os
from decision_engine import AlgentaClient
client = AlgentaClient(
api_key=os.environ["ALGENTA_API_KEY"],
base_url="https://api.algenta.ai",
)
connector = client.create_connector(
name="App SQL Server",
connector_type="mssql",
config={
"host": "db.internal",
"port": 1433,
"database": "app",
"user": "reader",
"password": os.environ["MSSQL_PASSWORD"],
"driver": "ODBC Driver 18 for SQL Server",
},
)
print(connector.id, connector.status) # "untested"Troubleshooting
Next
Connect a databasePostgreSQLConnectors referenceLast updated
Was this helpful?