A Python desktop application for connecting to SQL Server databases and viewing their schema.
-
Multiple Authentication Types:
- SQL Server Authentication (username/password)
- Windows Authentication (Trusted Connection)
- Azure Active Directory Password
- Azure Active Directory Integrated
- Azure Active Directory Interactive (MFA/2-Factor)
- Azure Active Directory Service Principal
-
Schema Browsing:
- View all databases on the server
- Browse tables, views, stored procedures, and functions
- View column details with data types, nullability, and key information
- View index information for tables
- View parameters for stored procedures and functions
- Python 3.8 or later
- SQL Server ODBC Driver (ODBC Driver 17 or 18 for SQL Server recommended)
- For Azure AD authentication: Azure AD-enabled SQL Server or Azure SQL Database
-
Clone or download this repository:
cd testcode -
Install the required Python packages:
pip install -r requirements.txt
-
Ensure you have the SQL Server ODBC driver installed:
- Windows: Download from Microsoft ODBC Driver for SQL Server
- macOS:
brew install msodbcsql18 - Linux: Follow the Linux installation guide
-
Run the application:
python main.py
-
Connect to a SQL Server:
- Go to File > Connect... or use the menu
- Enter your server name (e.g.,
localhost,myserver.database.windows.net) - Select the authentication type
- Enter credentials as required
- Click Connect
-
Browse the schema:
- Select a database from the dropdown
- Expand the tree to view tables, views, procedures, and functions
- Click on an object to view its details in the right panel
Standard SQL Server login with username and password.
Uses your Windows credentials for trusted connections. No username/password required.
Azure Active Directory authentication with username and password. Use for Azure SQL Database with AAD integration.
Uses your current Windows Azure AD credentials. Requires domain-joined machine with Azure AD.
Supports Multi-Factor Authentication. A browser window will open for interactive login. Best for users with MFA enabled.
Authentication using an Azure AD application. Requires:
- Client ID (Application ID)
- Client Secret
- Tenant ID (optional for some scenarios)
testcode/
├── main.py # Application entry point
├── connection.py # Database connection handling
├── schema_viewer.py # Schema retrieval and processing
├── gui.py # Tkinter GUI implementation
├── requirements.txt # Python dependencies
└── README.md # This file
If you see "Driver not found" errors, ensure the ODBC driver is installed:
# Check available drivers (Python)
import pyodbc
print(pyodbc.drivers())- Ensure your SQL Server/Azure SQL supports Azure AD authentication
- For interactive authentication, allow the browser popup
- For service principal, verify the client ID and secret are correct
Increase the connection timeout in the connection dialog options if connecting to a remote server.
This project is provided as-is for educational and development purposes.