View Categories

Anvil.works SQL Server Integration – Sync Live Database Data Automatically

7 min read

INTEGRATION

SQL Server Anvil

SQL Server SQL Server
Query Streams Query Streams
Anvil Anvil
Zero Code
Easy Setup
Fast

Query Streams enables seamless Anvil SQL Server integration, automatically syncing live SQL Server data to your Anvil sheets. Sign up for free at QueryStreams.com and start automating your SQL Server to Anvil data pipelines in minutes.

This guide shows you how to set up automated data synchronization from SQL Server to Anvil using Query Streams. Whether you need to keep project management sheets updated with database records, sync inventory data to collaborative workspaces, or automate reporting workflows, Query Streams provides a secure, no-code solution for SQL Server to Anvil.works integration.

Scheduled Automation

Sync hourly, daily, or on custom schedules

Secure by Design

Credentials stay on your network

Lightning Fast

Optimized data streaming

Smart Sync

Insert, update, delete automatically

What is Anvil SQL Server Integration?

Anvil SQL Server integration connects your SQL Server database to Anvil, enabling automatic data synchronization without manual exports or imports. Query Streams acts as a secure bridge between your database and Anvil, running saved SQL queries on a schedule and pushing the results directly to your sheets.

Key capabilities:

  • Automated sync: Schedule queries to run hourly, daily, or on custom intervals
  • Full sync mode: Insert new rows, update existing rows, and remove deleted records automatically
  • Append mode: Add new records without modifying existing data (ideal for logs and history)
  • Secure connection: Your database credentials stay protected within your network
  • No coding required: Configure everything through the Query Streams web portal

Prerequisites

1

Query Streams Agent Installed

The agent must be running on your network with access to your SQL Server database.

Install the Query Streams Agent →
2

SQL Server Data Source Configured

Your SQL Server database should be added as a data source in the agent.

Connect SQL Server to Query Streams →
3

Anvil Account

A Anvil account with API access (available on Business and Enterprise plans, or via free trial).

4

Saved Query

At least one saved query in Query Streams that returns the data you want to sync.

Step 1: Create Your SQL Server Query

1
2
3
4
5
6
7

Before setting up the integration, you need a saved query that returns the data you want to sync to Anvil.

  1. Log into the Query Streams portal: Visit my.querystreams.com and sign in
  2. Open the Query Builder: Navigate to the Query Builder from the dashboard
  3. Select your SQL Server data source: In the Data Explorer sidebar on the left, expand your Data Realm, then select your SQL Server connector and choose the database you want to query
  4. Write your SQL query: Create the query that returns the data you want to sync
SQL Server Query Example SQL
SELECT 
    order_id,
    customer_name,
    order_date,
    total_amount,
    status
FROM orders
WHERE order_date >= DATEADD(day, -30, GETDATE())
ORDER BY order_date DESC
LIMIT 1000;
  1. Test and save: Run the query to verify results, then save it with a descriptive name like “Recent Orders for Anvil”
Pro Tip: If you plan to use Full Sync mode, ensure your query includes a unique identifier column (like order_id) that Anvil can use to match rows.

Step 2: Create the Anvil.works integration

2
3
4
5
6
7

Now you’ll connect your saved query to Anvil through the Automation feature.

  1. Navigate to Automation: In the Query Streams portal, click Automation in the left sidebar
  2. Create new integration: Click New Integration to start the setup wizard
  3. Select your saved query: Choose the SQL Server query you created in Step 1
  4. Choose Anvil as destination: Select Anvil from the list of available platforms

Step 3: Connect Your Anvil Account

3
4
5
6
7

Anvil.works integration requires installing the Query Streams component in your Anvil.works app and configuring it with a secure connection key.

1

Add Third-Party Dependency

In your Anvil.works app, go to Settings → Dependencies

Click the “Third Party” tab and enter this code:

47C7VQG6QJTVY16B
2

Create Server Module

In your Anvil.works app, create a Server Module and add this code:

from querystreams import connector
connector.init_connector("YOUR_AUTH_KEY")
3

Generate Secure Auth Key

In the Query Streams automation setup:

  1. Click Generate Secure Key (or enter your own)
  2. Copy the auth key
  3. Replace YOUR_AUTH_KEY in your Anvil.works code with this key
4

Enter Anvil App URL

In Query Streams, enter your published Anvil.works app URL (anvil.app domain or your custom domain)

Examples: https://your-app.anvil.app or https://yourdomain.com

5

Test Connection

Click Test Connection to verify Query Streams can communicate with your Anvil.works app

Step 4: Select Your Destination Sheet

4
5
6
7

Choose where your SQL Server data will be synced in Anvil.works.

  1. Browse your sheets: Query Streams will display your available Anvil sheets and workspaces
  2. Select a sheet: Choose an existing sheet to sync data to, or select Create new sheet
  3. Column mapping: Query Streams will automatically map your SQL query columns to Anvil columns. Review and adjust if needed.
Tip: If creating a new sheet, Query Streams will automatically create columns based on your query results.

Step 5: Configure Sync Mode

5
6
7

Choose how Query Streams should handle data synchronization.

+

Append Mode

Best for logs & history
  • Adds new rows to the bottom
  • Never modifies existing rows
  • Never deletes data
  • Preserves historical records
Ideal for: Audit logs, transaction history, event tracking, time-series data

Full Sync Mode

Popular
Best for live data
  • Inserts new records
  • Updates changed records
  • Deletes removed records
  • Requires key column
Ideal for: Inventory, master data, active records, dashboards

Key Column Selection: If using Full Sync mode, select the column that uniquely identifies each row. This column must exist in both your SQL query results and your Anvil sheet.

Column Sync Behavior (SYNC vs PRESERVE)

For each column in your field mapping, choose how Query Streams should handle it during sync:

SYNC (Default)

Source value always overwrites target

Use for: Data columns that should match your database exactly (order status, totals, dates)

PRESERVE

Target value is never overwritten

Use for: Columns where you add manual notes, assignments, or status updates in Anvil.works
Example: Syncing Orders with Team Notes
Source Columns (from SQL Server)
  • order_id – Key field
  • customer_name – SYNC
  • status – SYNC
  • total – SYNC
User-Added Columns (in Anvil.works)
  • Assigned To – PRESERVE
  • Notes – PRESERVE
  • Priority – PRESERVE
Result: Every sync updates order data from the database while preserving your team’s notes and assignments.

Step 6: Set Your Sync Schedule

6
7

Configure when Query Streams should sync data from SQL Server to Anvil.

Manual Run syncs on-demand only
Every 5 MinutesHigh-frequency sync for real-time data
Every 10 MinutesNear real-time updates
Every 15 MinutesFrequent sync for active data
🕑
Hourly Sync every hour
📅
DailySync once per day at specified time
Custom Set specific days and times

Step 7: Review and Activate

7
  1. Review configuration: Verify all settings including query, destination, sync mode, and schedule
  2. Name your integration: Give it a descriptive name like “Orders to Anvil Daily Sync”
  3. Activate: Click Create Integration to save and activate
  4. Run initial sync: Click Run Now to perform the first synchronization and verify everything works

Congratulations!

Your SQL Server to Anvil.works integration is now live. Data will sync automatically according to your schedule.

Monitoring Your Integration

After activation, you can monitor your Anvil SQL Server integration from the Automation dashboard:

🕑

Last Sync Time

See when data was last synchronized

📊

Rows Synced

View counts of inserted, updated, and deleted rows

🔔

Error Alerts

Get notified if a sync fails

📃

Sync History

Review past sync operations and their results

Common Use Cases for Anvil SQL Server Integration

💼

Project Management

Sync project data, milestones, and resource allocations from your SQL Server database to Anvil for team collaboration and visibility.

💰

Sales Pipeline

Keep your sales team’s Anvil updated with the latest opportunities, deals, and customer information from your CRM database.

📦

Inventory Tracking

Automatically update inventory levels, stock counts, and product information in Anvil.works for warehouse and operations teams.

📈

Financial Reporting

Sync budget data, expense reports, and financial metrics to Anvil for executive dashboards and stakeholder reporting.

👥

HR and Operations

Keep employee directories, department rosters, and organizational data synchronized between your HRIS database and Anvil.

Frequently Asked Questions

How often can I sync data from SQL Server to Anvil? +

Query Streams supports sync schedules from every hour to custom intervals. For most use cases, daily or hourly syncs provide a good balance between data freshness and system resources.

🔒 Is my SQL Server data secure during sync? +

Yes. Your database credentials remain protected within your network through the Query Streams agent. Data is encrypted in transit, and your Anvil API token is stored securely. Query Streams never stores your raw database data.

What happens if a sync fails? +

Query Streams will retry failed syncs and notify you of persistent errors. You can view error details in the sync history and manually trigger a retry once the issue is resolved.

📂 Can I sync to multiple Anvil sheets from the same SQL Server database? +

Yes. Create separate integrations for each destination sheet. Each integration can use a different SQL query, sync mode, and schedule.

Does this work with cloud SQL Server services? +

Yes. Query Streams supports all SQL Server variants including Amazon RDS for SQL Server, Azure Database for SQL Server, Google Cloud SQL for SQL Server, PlanetScale, and self-hosted instances.

Updated on June 3, 2026

Powered by BetterDocs