Skip to content

Commit f0ef223

Browse files
authored
docs: Move the sqlc Dashboard section lower in getting started (#3110)
1 parent 023ab78 commit f0ef223

File tree

2 files changed

+85
-20
lines changed

2 files changed

+85
-20
lines changed

docs/tutorials/getting-started-mysql.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ We'll generate Go code here, but other
88
naturally need the Go toolchain if you want to build and run a program with the
99
code sqlc generates, but sqlc itself has no dependencies.
1010

11+
At the end, you'll push your SQL queries to [sqlc Cloud](https://dashboard.sqlc.dev/) for further insights and analysis.
12+
1113
## Setting up
1214

1315
Create a new directory called `sqlc-tutorial` and open it up.
@@ -181,3 +183,43 @@ database must have the `authors` table as defined in `schema.sql`.
181183

182184
You should now have a working program using sqlc's generated Go source code,
183185
and hopefully can see how you'd use sqlc in your own real-world applications.
186+
187+
## Query analysis and managed databases
188+
189+
[sqlc Cloud](https://dashboard.sqlc.dev) provides additional insights into your
190+
queries, catching subtle bugs and performance issues. To get started, create a
191+
[dashboard account](https://dashboard.sqlc.dev). Once you've signed in, create a
192+
project and generate an auth token. Add your project's ID to the `cloud` block
193+
to your sqlc.yaml.
194+
195+
```yaml
196+
version: "2"
197+
cloud:
198+
# Replace <PROJECT_ID> with your project ID from the sqlc Cloud dashboard
199+
project: "<PROJECT_ID>"
200+
sql:
201+
- engine: "mysql"
202+
queries: "query.sql"
203+
schema: "schema.sql"
204+
gen:
205+
go:
206+
package: "tutorial"
207+
out: "tutorial"
208+
```
209+
210+
Replace `<PROJECT_ID>` with your project ID from the sqlc Cloud dashboard. It
211+
will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`.
212+
213+
And finally, set the `SQLC_AUTH_TOKEN` environment variable:
214+
215+
```shell
216+
export SQLC_AUTH_TOKEN="<your sqlc auth token>"
217+
```
218+
219+
```shell
220+
$ sqlc push --tag tutorial
221+
```
222+
223+
In the sidebar, go to the "Insights" section to run checks against your queries.
224+
If you need access to a pre-configured MySQL database, check out [managed
225+
databases](../howtwo/managed-databases.md).

docs/tutorials/getting-started-postgresql.md

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ We'll generate Go code here, but other
88
naturally need the Go toolchain if you want to build and run a program with the
99
code sqlc generates, but sqlc itself has no dependencies.
1010

11-
We'll also rely on sqlc's [managed databases](../howto/managed-databases.md),
12-
which require a sqlc Cloud project and auth token. You can get those from
13-
the [sqlc Cloud dashboard](https://dashboard.sqlc.dev/). Managed databases are
14-
an optional feature that improves sqlc's query analysis in many cases, but you
15-
can turn it off simply by removing the `cloud` and `database` sections of your
16-
configuration.
11+
At the end, you'll push your SQL queries to [sqlc
12+
Cloud](https://dashboard.sqlc.dev/) for further insights and analysis.
1713

1814
## Setting up
1915

@@ -31,31 +27,17 @@ following contents:
3127

3228
```yaml
3329
version: "2"
34-
cloud:
35-
# Replace <PROJECT_ID> with your project ID from the sqlc Cloud dashboard
36-
project: "<PROJECT_ID>"
3730
sql:
3831
- engine: "postgresql"
3932
queries: "query.sql"
4033
schema: "schema.sql"
41-
database:
42-
managed: true
4334
gen:
4435
go:
4536
package: "tutorial"
4637
out: "tutorial"
4738
sql_package: "pgx/v5"
4839
```
4940
50-
Replace `<PROJECT_ID>` with your project ID from the sqlc Cloud dashboard. It
51-
will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`.
52-
53-
And finally, set the `SQLC_AUTH_TOKEN` environment variable:
54-
55-
```shell
56-
export SQLC_AUTH_TOKEN="<your sqlc auth token>"
57-
```
58-
5941
## Schema and queries
6042
6143
sqlc needs to know your database schema and queries in order to generate code.
@@ -220,3 +202,44 @@ database must have the `authors` table as defined in `schema.sql`.
220202

221203
You should now have a working program using sqlc's generated Go source code,
222204
and hopefully can see how you'd use sqlc in your own real-world applications.
205+
206+
## Query analysis and managed databases
207+
208+
[sqlc Cloud](https://dashboard.sqlc.dev) provides additional insights into your
209+
queries, catching subtle bugs and performance issues. To get started, create a
210+
[dashboard account](https://dashboard.sqlc.dev). Once you've signed in, create a
211+
project and generate an auth token. Add your project's ID to the `cloud` block
212+
to your sqlc.yaml.
213+
214+
```yaml
215+
version: "2"
216+
cloud:
217+
# Replace <PROJECT_ID> with your project ID from the sqlc Cloud dashboard
218+
project: "<PROJECT_ID>"
219+
sql:
220+
- engine: "postgresql"
221+
queries: "query.sql"
222+
schema: "schema.sql"
223+
gen:
224+
go:
225+
package: "tutorial"
226+
out: "tutorial"
227+
sql_package: "pgx/v5"
228+
```
229+
230+
Replace `<PROJECT_ID>` with your project ID from the sqlc Cloud dashboard. It
231+
will look something like `01HA8SZH31HKYE9RR3N3N3TSJM`.
232+
233+
And finally, set the `SQLC_AUTH_TOKEN` environment variable:
234+
235+
```shell
236+
export SQLC_AUTH_TOKEN="<your sqlc auth token>"
237+
```
238+
239+
```shell
240+
$ sqlc push --tag tutorial
241+
```
242+
243+
In the sidebar, go to the "Insights" section to run checks against your queries.
244+
If you need access to a pre-configured PostgreSQL database, check out [managed
245+
databases](../howtwo/managed-databases.md).

0 commit comments

Comments
 (0)