Skip to main content
Community Hub
TL;DR

Complete API reference for BaseSQLHandler - the concrete implementation of HandlerInterface for SQL-based data sources.

Your AI can read this via Docs MCPcurl -fsSL "https://docs.atlan.com/install-docs-mcp" | bashConnect

BaseSQLHandler

Class
📁application_sdk.handlers.sql
Inheritance chain:
HandlerInterface

A concrete implementation of HandlerInterface specifically designed for interacting with SQL-based data sources. Uses SQLClient for database communication and provides SQL query-driven behavior with configurable SQL queries for common operations.

SQL Queries

test_authentication_sqlstr
Query to test connection/authentication. Used by test_auth() method.
Default: "SELECT 1;"
client_version_sqlstr
Query to fetch database client version. Used in check_client_version() within preflight_check().
metadata_sqlstr
Query to fetch database and schema names together. Used by prepare_metadata() called by fetch_metadata().
tables_check_sqlstr
Query to count tables based on filters. Used by tables_check() within preflight_check().
fetch_databases_sqlstr
Query to fetch only database names. Used when metadata_type is 'database'.
fetch_schemas_sqlstr
Query to fetch schema names for a given database. Used when metadata_type is 'schema'.

Methods5

▸

__init__

__init__(self, sql_client)
Initialize the handler with a required SQLClient instance
Parameters
sql_clientSQLClient
Required
SQL client instance for database communication
▸

load

async
async load(self, credentials)
Calls load() on the provided SQL client with the given credentials
Parameters
credentialsdict
Required
Database authentication credentials
▸

test_auth

async
async test_auth(self, **kwargs) -> bool
Executes test_authentication_sql query using SQLQueryInput to test database connectivity
Parameters
kwargsdict
Required
Keyword arguments (typically empty for basic auth test)
Returns
bool - True if authentication succeeds, False otherwise
▸

preflight_check

async
async preflight_check(self, payload, **kwargs) -> dict
Orchestrates several checks: check_schemas_and_databases() (validates include/exclude filters), tables_check() (counts tables using tables_check_sql), and check_client_version() (verifies against SQL_SERVER_MIN_VERSION)
Parameters
payloaddict
Required
Payload containing configuration and filters
kwargsdict
Optional
Additional keyword arguments
Returns
dict - Dictionary with check results and overall success status
▸

fetch_metadata

async
async fetch_metadata(self, **kwargs) -> Any
Based on metadata_type argument, calls prepare_metadata() (executes metadata_sql), fetch_databases() (executes fetch_databases_sql), or fetch_schemas() (executes fetch_schemas_sql)
Parameters
kwargsdict
Required
Keyword arguments including metadata_type and filters
Returns
Any - Metadata based on the requested type

Usage Examples

Basic SQL Handler Usage

Create a BaseSQLHandler with a specific SQL client for database operations

from application_sdk.handlers.sql import BaseSQLHandler
from .clients import PostgreSQLClient

# Initialize with specific SQL client
client = PostgreSQLClient()
handler = BaseSQLHandler(sql_client=client)

# Use with Application
from application_sdk.server.fastapi import APIServer
app = APIServer(handler=handler)