Skip to content

Commit 045f5ff

Browse files
committed
update readme
1 parent e0c6d30 commit 045f5ff

File tree

1 file changed

+91
-1
lines changed

1 file changed

+91
-1
lines changed

alter_default_value_in_column/README.MD

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,95 @@ SCHEMA >
1919
- `payload` String `json:$.payload`
2020
```
2121

22-
- Create a PR with the change above, a new branch will be created as part of the CI process. You can double check the default value is what you expect by ingesteing some null value in the CI branch created.
22+
- Create a PR with the change above, a new branch will be created as part of the CI process. You can double check the default value is what you expect by ingesting some null value in the CI branch created.
23+
24+
For instance, in this case ingest an empty event using the Tinybird branch token:
25+
26+
```sh
27+
curl \
28+
-X POST 'https://api.tinybird.co/v0/events?name=analytics_events' \
29+
-H "Authorization: Bearer $BRANCH_TOKEN" \
30+
-d $'{}'
31+
{"successful_rows":1,"quarantined_rows":0}%
32+
```
33+
34+
Check the content of the Data Source:
35+
36+
```
37+
curl https://api.tinybird.co/v0/sql?q=SELECT%20*%20FROM%20analytics_events%20LIMIT%20100%20%0A%20FORMAT%20JSON&token=$BRANCH_TOKEN
38+
39+
{
40+
"meta":
41+
[
42+
{
43+
"name": "timestamp",
44+
"type": "DateTime"
45+
},
46+
{
47+
"name": "session_id",
48+
"type": "String"
49+
},
50+
{
51+
"name": "action",
52+
"type": "LowCardinality(String)"
53+
},
54+
{
55+
"name": "version",
56+
"type": "LowCardinality(String)"
57+
},
58+
{
59+
"name": "payload",
60+
"type": "String"
61+
}
62+
],
63+
64+
"data":
65+
[
66+
{
67+
"timestamp": "2024-07-15 18:04:45",
68+
"session_id": "",
69+
"action": "None",
70+
"version": "1.0",
71+
"payload": "{}"
72+
}
73+
],
74+
75+
"rows": 1,
76+
77+
"rows_before_limit_at_least": 1,
78+
79+
"statistics":
80+
{
81+
"elapsed": 0.00113733,
82+
"rows_read": 1,
83+
"bytes_read": 26
84+
}
85+
}
86+
```
87+
88+
You can see all columns have their default value.
89+
90+
2391
- To deploy the change, merge to PR to you main branch, the CD job will run and will deploy the changes.
92+
93+
```
94+
...
95+
** Diffs from current commit '7457be4ad47c137aff1537ae91626b9722c4a89d' and new 'e0c6d30e685bb996c01b2dd37ec66690a2fc0ce8':
96+
modified: alter_default_value_in_column/datasources/analytics_events.datasource
97+
** Preparing commit ...
98+
** Processing ./datasources/analytics_events.datasource
99+
** Building dependencies
100+
** [DRY RUN] Deploying commit ...
101+
** [DRY RUN] Running 'analytics_events'
102+
** Deploying commit ...
103+
** Running 'analytics_events'
104+
** The description or schema of 'analytics_events' has changed.
105+
** - MODIFY COLUMN `timestamp` DEFAULT now()
106+
** - MODIFY COLUMN `session_id` DEFAULT ''
107+
** - MODIFY COLUMN `action` DEFAULT 'None'
108+
** - MODIFY COLUMN `version` DEFAULT '1.0'
109+
** - MODIFY COLUMN `payload` DEFAULT '{}'
110+
** The Data Source has been correctly updated.
111+
** 'analytics_events' created
112+
...
113+
```

0 commit comments

Comments
 (0)