You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/examples/sqlmesh_cli_crash_course.md
+124-3Lines changed: 124 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -325,12 +325,12 @@ Run data diff against prod. This is a good way to verify the changes are behavin
325
325
326
326
## **Enhanced Testing Workflow**
327
327
328
-
You'll use these commands ad hoc to validate your changes are behaving as expected. Audits (data tests) are a great first step, and you'll want to evolve into to feel confident about the changes. The workflow is as follows:
328
+
You'll use these commands to validate your changes are behaving as expected. Audits (data tests) are a great first step, and you'll want to grow from there to feel confident about your changes. The workflow is as follows:
329
329
330
-
1. Create external models outside of SQLMesh's control (ex: data loaded in by Fivetran, Airbyte, etc.)
330
+
1. Create and audit external models outside of SQLMesh's control (ex: data loaded in by Fivetran, Airbyte, etc.)
331
331
2. Automatically generate unit tests
332
332
3. Ad hoc query the data directly in the CLI
333
-
333
+
4. Add linting
334
334
335
335
=== "SQLMesh"
336
336
@@ -344,6 +344,127 @@ You'll use these commands ad hoc to validate your changes are behaving as expect
344
344
tcloud sqlmesh create_external_models
345
345
```
346
346
347
+
??? "Example Output"
348
+
Note: this is an example from a separate Tobiko Cloud project, so you can't following along in the github repo above.
349
+
350
+
- Generated external models from the `bigquery-public-data` dataset.
351
+
- I added an audit to the external model to ensure `event_date` is not null.
352
+
- Viewed a plan preview of the changes that will be made to the external model.
353
+
354
+
```sql
355
+
-- models/external_model_example.sql
356
+
MODEL (
357
+
name tcloud_demo.external_model
358
+
);
359
+
360
+
SELECT
361
+
event_date,
362
+
event_timestamp,
363
+
event_name,
364
+
event_params,
365
+
event_previous_timestamp,
366
+
event_value_in_usd,
367
+
event_bundle_sequence_id,
368
+
event_server_timestamp_offset,
369
+
user_id,
370
+
user_pseudo_id,
371
+
privacy_info,
372
+
user_properties,
373
+
user_first_touch_timestamp,
374
+
user_ltv,
375
+
device,
376
+
geo,
377
+
app_info,
378
+
traffic_source,
379
+
stream_id,
380
+
platform,
381
+
event_dimensions,
382
+
ecommerce
383
+
/* items */
384
+
FROM bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_20210131 -- I fully qualified the external table name and sqlmesh will automatically create the external model
You'll use these commands ad hoc to validate your changes are behaving as expected. Audits (data tests) are a great first step, and you'll want to evolve into to feel confident about the changes. The workflow is as follows:
0 commit comments