Skip to main content

Overview

shopMaster connects to your local SQL Server database to track and synchronize product changes. You can use either Windows Authentication or SQL Server Authentication (username/password) to establish the connection.

Connection methods

shopMaster supports two authentication methods for SQL Server:
SQL Server Authentication uses a database username and password. Use this method when connecting to remote servers or when Windows Authentication isn’t available.When to use:
  • You’re connecting to a remote SQL Server instance
  • Windows Authentication is not configured
  • You need to use a specific SQL Server login account

Required information

Before configuring your connection, gather the following information:
1

Server name

The name or IP address of your SQL Server instance.Examples:
  • localhost or . for local instances
  • DESKTOP-ABC123\SQLEXPRESS for named instances
  • 192.168.1.100 for remote servers
  • server.domain.com\INSTANCE for domain servers
2

Database name

The exact name of the database containing your product table.Example: ProductsDB or InventorySystem
3

Table name

The name of the table that contains your product data. This table must have columns for:
  • ProductID (VARCHAR(25))
  • ProductName (VARCHAR(75))
  • SellPrice (NUMERIC(18, 2))
  • QrCode (VARCHAR(100))
  • Status (INT)
Example: Products or dbo.Inventory
4

Authentication credentials (if using SQL Server Authentication)

  • Username: Your SQL Server login name
  • Password: Your SQL Server password
Ensure your SQL Server account has the following permissions:
  • SELECT, INSERT, UPDATE, DELETE on your product table
  • CREATE TABLE permission (for the ChangeLog table)
  • CREATE TRIGGER permission (for change tracking triggers)

How connection strings work

shopMaster builds connection strings using SQLAlchemy and the ODBC Driver 17 for SQL Server. Understanding the format helps you troubleshoot connection issues.

Windows Authentication format

mssql+pyodbc://:@{server_name}/{database_name}?driver=ODBC+Driver+17+for+SQL+Server&Trusted_Connection=yes
Example:
mssql+pyodbc://:@localhost/ProductsDB?driver=ODBC+Driver+17+for+SQL+Server&Trusted_Connection=yes
The empty :@ before the server name indicates no username or password is needed. The Trusted_Connection=yes parameter tells SQL Server to use Windows credentials.

SQL Server Authentication format

mssql+pyodbc://{username}:{password}@{server_name}/{database_name}?driver=ODBC+Driver+17+for+SQL+Server
Example:
mssql+pyodbc://dbuser:SecurePass123@localhost/ProductsDB?driver=ODBC+Driver+17+for+SQL+Server
Special characters in passwords must be URL-encoded. For example, @ becomes %40, # becomes %23.

Testing your connection

shopMaster includes a built-in connection test feature.
1

Open Settings

Click the Settings button in the shopMaster sidebar.
2

Enter connection details

Fill in your server name, database name, table name, and authentication credentials.
3

Click 'Test Connection'

The application will attempt to connect and execute a simple query:
SELECT 1
This verifies that:
  • The server is reachable
  • Your credentials are valid
  • The database exists and is accessible
4

Review the result

You’ll see one of these messages:

Connection test implementation

The test executes this code (from app/helper.py:15):
def test_connectionString(db_url):
    try:
        engine = create_engine(db_url)
        with engine.connect() as connection:
            result = connection.execute(text("SELECT 1"))
            for row in result:
                print("Connection successful:", row)
                return "Connection Successful"
    except Exception as e:
        print("Connection failed:", e)
        return str(e)

Initial configuration

After testing your connection, you need to configure shopMaster to enable change tracking.
1

Ensure connection test succeeds

Always test your connection before clicking Configure.
2

Click 'Configure'

This performs several critical setup tasks:
  1. Creates the ChangeLog table - Stores insert, update, and delete operations
  2. Creates three triggers on your product table:
    • trgAfterInsert - Logs new products
    • trgAfterUpdate - Logs product changes
    • trgAfterDelete - Logs deleted products
  3. Saves configuration to your .env file
  4. Stores your Digible access token
3

Verify success

You should see “Configuration Successful” message. Your database now has:
  • A new ChangeLog table
  • Three triggers on your product table

What happens during configuration

The configuration process creates this table structure:
CREATE TABLE ChangeLog (
    LogID INT IDENTITY(1,1) PRIMARY KEY,
    ChangeType NVARCHAR(10),
    ProductID VARCHAR(25),
    ProductName VARCHAR(75),
    SellPrice NUMERIC(18, 2),
    QrCode VARCHAR(100),
    Status INT,
    ChangeDateTime DATETIME DEFAULT GETDATE()
);
The ChangeLog table is automatically cleared after each successful sync. This keeps your database lean and prevents duplicate syncs.

ODBC Driver requirements

shopMaster requires ODBC Driver 17 for SQL Server. If you encounter driver-related errors, you need to install it.

Download and install

  1. Download from Microsoft’s official site
  2. Run the installer
  3. Restart shopMaster after installation

Verify installation

You can check which ODBC drivers are installed: Windows:
  1. Open ODBC Data Sources (search in Start menu)
  2. Go to the Drivers tab
  3. Look for “ODBC Driver 17 for SQL Server”
Alternative method:
Get-OdbcDriver | Where-Object {$_.Name -like "*SQL Server*"}
If you have ODBC Driver 18, you may need to modify the connection string or install Driver 17 alongside it. shopMaster specifically uses Driver 17.

Security best practices

Windows Authentication is more secure because:
  • No passwords stored in the .env file
  • Leverages existing Windows security
  • Supports multi-factor authentication if configured
  • Easier to manage with Active Directory
Create a dedicated SQL Server account for shopMaster with only the permissions it needs:
-- Create a dedicated login
CREATE LOGIN shopmaster_sync WITH PASSWORD = 'StrongPassword123!';

-- Create user in your database
USE ProductsDB;
CREATE USER shopmaster_sync FOR LOGIN shopmaster_sync;

-- Grant minimum required permissions
GRANT SELECT, INSERT, UPDATE, DELETE ON dbo.Products TO shopmaster_sync;
GRANT CREATE TABLE TO shopmaster_sync;
GRANT ALTER ON SCHEMA::dbo TO shopmaster_sync;
The .env file stores sensitive information:
  • Database connection strings
  • SQL Server passwords (if using SQL Auth)
  • Digible API access tokens
Security measures:
  • Never commit .env to version control
  • Restrict file permissions (Windows: only your user account)
  • Store backups securely
  • Rotate passwords regularly
If connecting to a remote SQL Server, enable encryption:
  1. Configure SSL/TLS on SQL Server
  2. Modify connection string to include:
    &Encrypt=yes&TrustServerCertificate=no
    

Connection string examples

Local SQL Server Express (Windows Auth)

mssql+pyodbc://:@localhost\SQLEXPRESS/ProductsDB?driver=ODBC+Driver+17+for+SQL+Server&Trusted_Connection=yes

Local SQL Server (SQL Auth)

mssql+pyodbc://sa:MyPassword123@localhost/ProductsDB?driver=ODBC+Driver+17+for+SQL+Server

Remote SQL Server with instance name

mssql+pyodbc://dbuser:[email protected]\PRODUCTION/ProductsDB?driver=ODBC+Driver+17+for+SQL+Server

Remote SQL Server with port number

mssql+pyodbc://dbuser:[email protected],1433/ProductsDB?driver=ODBC+Driver+17+for+SQL+Server

Next steps

Start syncing

Begin synchronizing your product data with Digible

Troubleshooting

Solve common connection and sync issues

Best practices

Optimize your shopMaster deployment

API Reference

Explore connection functions

Build docs developers (and LLMs) love