Microsoft SQL Server

The SQL Server action depends on the python pyodbc library. You can find complete documentation about the library here (opens in a new tab).

There are a variety of ways to configure a pyodbc connection depending on your security implementation. A standard connection would consist of a host, port, database name, user, and password.

Fields

FieldRequiredDefaultDescription
db-hostnoThe MSSQL database host
db-portno1433The MSSQL database port.
db-database-namenoThe database name
db-usernosaThe database user
db-passwordnoThe database password
encryptnoTrue/False Indicates whether to use an encrypted connection to mssql
trusted_connectionnoTrue/False whether the SQL Server connection is trusted. Sets Trusted_Connection=yes in pyodbc.
protocolnotcpConnection protocol for the database. One of 'tcp', 'Icp', or 'NP'
server_connection_stringnoAn optional ODBC server connection string to use when connecting to the server. These are usually constructed as {protocol}:{host},{port}. This
trust_server_certificatenotrueSets the ODBC connection string TrustServerCertificate

Example

on:
  - pull_request
name: SQL Server
jobs:
  test_mssql:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Run Grai Action
        uses: grai-io/grai-actions/mssql@master
        with:
          namespace: my_apps_grai_namespace
          api-key: my_grai_api_key
          action: tests
          source-name: prod-db
          grai-api-url: https://api.grai.io
          db-user: sa
          db-password: sa_password
          server_connection_string: tcp:myserver,1433
          trust_server_certificate: 'true'