E-Bike Fleet Intelligence
E-bike fleet intelligence solution powered by Data Studio synthetic datasets.
Data Source
Data is generated using Data Studio in the ORS Control Panel, which writes to:
SYNTHETIC_DATASETS.UNIFIED.FACT_VEHICLE_TELEMETRYSYNTHETIC_DATASETS.UNIFIED.FACT_TRIPS
Projection views in FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE read active-dataset projections (V_FACT_TRIPS_CURRENT, V_DIM_POIS_CURRENT) and filter by vehicle type and region via a CONFIG table. See references/sql-projection-views.sql for the complete view definitions.
Objects created:
CONFIG- single-row filter table (VEHICLE_TYPE + REGION)TRIPS+ORIGINS_ENRICHED- React fleet page views
The San Francisco baseline is loaded by install-fleet-apps Step 8 into UNIFIED tables.
Configuration
| Parameter | Default | Description |
|---|---|---|
DATABASE |
FLEET_INTELLIGENCE |
Target database for all objects |
SCHEMA |
FLEET_INTELLIGENCE_EBIKE |
Schema for projection views and CONFIG |
WAREHOUSE |
ROUTING_ANALYTICS |
Warehouse for queries |
VEHICLE_TYPE |
ebike |
Vehicle type filter applied to UNIFIED tables |
REGION |
san_francisco |
Region filter applied to UNIFIED tables |
Prerequisites
- Snowflake Account with appropriate privileges
- OpenRouteService Native App installed from Snowflake Marketplace (for Data Studio generation)
- Data Studio dataset generated in ORS Control Panel (or seed data loaded by
install-fleet-appsStep 8)
Required Privileges
| Privilege | Scope | Reason |
|---|---|---|
| CREATE DATABASE | Account | Creates FLEET_INTELLIGENCE database |
| CREATE WAREHOUSE | Account | Creates ROUTING_ANALYTICS warehouse |
| CREATE SCHEMA | Database (FLEET_INTELLIGENCE) | Creates FLEET_INTELLIGENCE_EBIKE schema |
| CREATE TABLE | Schema | Creates CONFIG table |
| CREATE VIEW | Schema | Creates projection views |
| SELECT ON SYNTHETIC_DATASETS.UNIFIED | Schema | Reads Data Studio output tables |
Note: ACCOUNTADMIN is NOT required. Create a custom role with the above privileges.
Error Logging
Follow the Error Logging convention in AGENTS.md. Log file prefix:
fleet-intelligence-ebike.
Quick Start
The primary data path is Data Studio in the ORS Control Panel:
- Open the ORS Control Panel > Data Studio page
- Select the
ebike(Urban E-Bike Fleet) profile - Configure region, fleet size, and generation parameters
- Run the generation job
This writes to SYNTHETIC_DATASETS.UNIFIED.FACT_VEHICLE_TELEMETRY and SYNTHETIC_DATASETS.UNIFIED.FACT_TRIPS. The projection views in Step 10 read from these tables.
Alternative: Load San Francisco Baseline from Seed Data
Seed data is pre-loaded by install-fleet-apps Step 8 into SYNTHETIC_DATASETS.UNIFIED. To create the projection views:
Execute references/seed-data.sql. This creates CONFIG, TRIPS, and ORIGINS_ENRICHED views over UNIFIED data.
Workflow
Execute each step in order using snowflake_sql_execute. Substitute {PLACEHOLDER} values based on the user's chosen configuration before executing.
CRITICAL: Execution Rules
These rules MUST be followed to avoid silent failures:
One statement per
snowflake_sql_executetool call. Never combine multiple SQL statements (CREATE, INSERT, SET, USE) in a single tool call. Multi-statement blocks can silently fail -- tables may be created with 0 rows and no error is reported. This rule applies to thesnowflake_sql_executetool only;snow sql -fand other CLI execution is fine.Always use fully qualified object names. Use
FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.<object>instead of relying onUSE DATABASE/USE SCHEMA. Session context fromUSEstatements does not persist acrosssnowflake_sql_executecalls.Never use
SETsession variables. Variables set withSET VAR = 'value'do not persist across calls. Instead, substitute literal values directly into the SQL before execution.Verify row counts after each CTAS. Run
SELECT COUNT(*) FROM <table>after everyCREATE TABLE ... AS SELECTto catch silent failures early.All CREATE statements must include a COMMENT tracking tag per AGENTS.md convention:
COMMENT = '{"origin":"sf_sit-is-fleet","name":"oss-fleet-intelligence-ebike",...}'. Seereferences/sql-projection-views.sqlfor tagged SQL.
Step 1: Set Query Tag for Tracking
ALTER SESSION SET query_tag = '{"origin":"sf_sit-is-fleet","name":"oss-fleet-intelligence-ebike","version":{"major":1, "minor":0},"attributes":{"is_quickstart":1, "source":"sql"}}';
Step 2: Configure Database, Warehouse, and Schema
Create FLEET_INTELLIGENCE database, ROUTING_ANALYTICS warehouse, and FLEET_INTELLIGENCE_EBIKE schema.
Step 3: Create Projection Views
Run references/sql-projection-views.sql to create CONFIG table + projection views from SYNTHETIC_DATASETS.UNIFIED. Creates 3 objects: 1 config table + 2 React views (TRIPS, ORIGINS_ENRICHED).
Step 4: Verify
SELECT 'CONFIG' AS TBL, COUNT(*) AS CNT FROM FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.CONFIG
UNION ALL SELECT 'TRIPS', COUNT(*) FROM FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.TRIPS
UNION ALL SELECT 'ORIGINS_ENRICHED', COUNT(*) FROM FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.ORIGINS_ENRICHED;
Expected: CONFIG=1, TRIPS and ORIGINS_ENRICHED > 0 (row counts depend on Data Studio generation or seed data).
Troubleshooting
| Issue | Solution |
|---|---|
| No data in projection views | Run Data Studio generation with ebike profile for your region |
| CONFIG table missing | Run Step 3 to create CONFIG + projection views |
Cleanup
To remove all objects created by this skill:
DROP VIEW IF EXISTS FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.ORIGINS_ENRICHED;
DROP VIEW IF EXISTS FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.TRIPS;
DROP TABLE IF EXISTS FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE.CONFIG;
DROP SCHEMA IF EXISTS FLEET_INTELLIGENCE.FLEET_INTELLIGENCE_EBIKE;
Tip: Use the
cleanupskill to auto-discover all tagged objects via COMMENT tracking.