Every apply replaces all monitors in a namespace, so each customer needs its own namespace; business rules still have to be written yourself in SQL.
Key takeaways
- Table monitors can detect broken and stalled pipelines, and most integrations work out of the box with no configuration.
- Each customer's business rules should go into validation monitors: pick a template, or write your own SQL.
- Monitors as code makes rules versionable and reviewable, but every apply replaces all monitors in a namespace.
When using Monte Carlo, the most dangerous mistake isn't poorly written SQL—it's the
apply
command. According to the monitors as code documentation, every apply replaces all monitors in a namespace. If you apply from customer A's repository to customer B's namespace, B's alerts will silently disappear.
For a Forward Deployed Engineer (FDE), this operational detail matters more than any product pitch deck. Your job on-site is to make the customer's data trustworthy, then deliver a system that keeps working after you leave.
If the customer is already using Monte Carlo, or you've been entrusted with setting it up for them, the first thing to do is figure out which work the tool handles automatically and which you need to write yourself.
What runs automatically, and what do you need to write yourself?
Table monitors are a built-in set of monitors that detect where data breaks or stops flowing. According to the documentation, for most integrations, table monitors take effect immediately with no user configuration. In your first week at a new customer, you already have a basic safety net: if a table stops updating, someone will know.
But table monitors know nothing about the customer's business. They don't know that an order can't be delivered before it's placed, or that revenue in the data warehouse must reconcile with the payment system.
Rules like these should go into validation monitors. According to the documentation, you can choose a template or write your own SQL; these monitors are suited for row-level checks, specific business logic, or comparing metrics across multiple data sources.
Monte Carlo's own blog also describes SQL Rules as a way to add custom monitors for specific scenarios, complementing automated anomaly detection. Simply put: the automated part catches technical failures, and what you write catches errors only someone who understands the business would notice.
Writing a rule for a delivery company
Suppose the customer is a delivery company with a
orders
table. Through customer research, you learn three rules the operations team takes for granted: delivery time can't be earlier than order time; delivered orders must have a driver ID; and the daily order total in the data warehouse must match the payment system.
The first rule can be written as a SQL query that directly returns the violating rows:
SELECT order_id, created_at, delivered_at FROM orders WHERE delivered_at < created_at AND created_at >= CURRENT_DATE - 1
Written this way, when an alert fires, the on-call engineer can open it and see exactly which orders are wrong, without guessing.
The third rule is a cross-source metric comparison. Suppose payment data has been loaded into the
payments
table in the same data warehouse; you could write something like this, returning only the dates where the two sides disagree:
SELECT o.day, o.order_total, p.payment_total FROM ( SELECT DATE(created_at) AS day, SUM(amount) AS order_total FROM orders WHERE created_at >= CURRENT_DATE - 7 GROUP BY 1 ) o JOIN ( SELECT DATE(paid_at) AS day, SUM(amount) AS payment_total FROM payments WHERE paid_at >= CURRENT_DATE - 7 GROUP BY 1 ) p ON o.day = p.day WHERE o.order_total <> p.payment_total
Both queries deliberately limit the time window: the first only looks at orders since yesterday, and the second compares the last seven days, making it easy to see which day the discrepancy appeared. The reason is that MotherDuck's integration documentation notes that query complexity and result set size affect monitor performance.
A rule that scans the entire order history on every run will be slow and will consume the customer's resources, so scope it down and return only the columns needed to handle an incident.
The workflow MotherDuck describes is exactly the order of operations you should follow on-site: connect the data sources first, then create custom SQL monitors for tables, whether data is updating on time, or metrics that need tracking.
The customer's rules should live in Git
Creating rules manually in the UI is quick, but hard to hand over. Monte Carlo supports defining monitors as code with YAML; the CLI reads the YAML files and syncs the declared state to Monte Carlo. This way, every customer's rules have versions and pull requests, and get reviewed before going live.
The following example only illustrates how a repository could be organized; verify the exact field names and command syntax against the monitors as code documentation before using it:
# monitors/delivery-co/orders.yaml
namespace: delivery-co-orders
monitors:
- name: delivered_before_created
type: validation
sql: |
SELECT order_id, created_at, delivered_at
FROM orders
WHERE delivered_at < created_at
AND created_at >= CURRENT_DATE - 1
- name: daily_revenue_matches_payments
type: validation
sql: |
-- 上文的跨数据源查询The
apply
command mentioned at the start becomes critical here. Since every apply replaces all monitors in a namespace, the documentation recommends setting up a separate namespace for each team or pipeline. In the example above, the namespace includes both the customer name and the pipeline name, so the payments team's files will never overwrite the orders team's rules.
The documentation also specifies that the
--auto-yes
flag that skips the confirmation step should only be used in CI environments. A sensible convention is: CI runs apply after a pull request is approved, and no one skips the confirmation on their personal machine. Set the namespace naming convention on day one, before writing the second rule.
What to learn first, and what to put on your resume
The most valuable thing to learn isn't Monte Carlo's interface, but the ability to turn a customer's one-liner like "delivered orders must have a driver" into a testable, cheap-to-run, readable SQL check.
This skill transfers to any data quality tool. And as Monte Carlo (now using the montecarlo.ai domain) positions itself as a tool for monitoring, troubleshooting, and improving AI agents and their underlying data, the value of this skill keeps rising.
When reading FDE job descriptions, watch for keywords like data quality, observability, monitors as code, or CI/CD for data. On your resume, don't just write "used Monte Carlo"—spell out how many of the customer's business rules you turned into monitors versioned in Git, and how you organized namespaces so multiple teams could collaborate without interfering with each other.
Automated alerts tell you the pipeline is still running. The rules you leave in the repository will keep telling the customer's team that the data is still correct, long after you've left the project.
Was this article helpful?
Thanks for your feedback!