Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Asciidoc source blocks to gensql blocks for runnable examples inthe browser #114

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/modules/ROOT/partials/base/commands.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The `+.import+` command creates a table from a `+.csv+` file.
.Import a table from a `+.csv+` file
[example]
====
[source,gensql]
[gensql]
----
.import /path/to/satellites.csv satellites
----
Expand All @@ -26,7 +26,7 @@ The `+.export+` command writes a table to disk as a `+.csv+` file.
.Export a table to a `+.csv+` file
[example]
====
[source,gensql]
[gensql]
----
.export /path/to/satellites.csv satellites
----
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/partials/base/scalar-expressions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Basic arithmetic like multiplication, subtraction, addition, and division can be

[example]
====
[source,gensql]
[gensql]
----
SELECT PROBABILITY OF VAR Apogee_km > Apogee_km UNDER military_model
----
Expand All @@ -54,7 +54,7 @@ SELECT PROBABILITY OF VAR Apogee_km > Apogee_km UNDER military_model

[example]
====
[source,gensql]
[gensql]
----
SELECT PROBABILITY DENSITY OF VAR Apogee_km < 1000
UNDER model CONDITIONED BY VAR Users = "Military"
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/partials/base/statements/alter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+ALTER+` command adds new columns to a table in the database.
.Add a column to the `+satellites+` table
[example]
====
[source,gensql]
[gensql]
----
ALTER satellites ADD Swath!
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+CREATE TABLE+` statement assigns a name to a table so it can be referenced
.Assign a name to a <<VALUES,table literal>>
[example]
====
[source,gensql]
[gensql]
----
CREATE TABLE launch_sites AS
(Launch_Site, State) VALUES
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/partials/base/statements/drop-model.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+DROP MODEL+` statement removes a model from the database.

[example]
====
[source,gensql]
[gensql]
----
DROP MODEL model!
----
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/partials/base/statements/drop-table.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+DROP TABLE+` statement removes a table from the database.

[example]
====
[source,gensql]
[gensql]
----
DROP TABLE satellites!
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+INSERT INTO+` statement inserts a table into a table.
.Insert two rows into the `+satellites+` table
[example]
====
[source,gensql]
[gensql]
----
INSERT INTO satellites
(Users, Apogee_km, Perigee_km) VALUES
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/partials/base/statements/update.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+UPDATE+` statement modifies the contents of a table in the database.
.Rename a launch site
[example]
====
[source,gensql]
[gensql]
----
UPDATE satellites
SET Launch_Site = "Majestic Cape Canaveral"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+ALTER+` expression evaluates to the a copy of a table with a new empty col
.Retrieve the `+satellites+` table with a new column added
[example]
====
[source,gensql]
[gensql]
----
ALTER satellites ADD Swath
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+INSERT+` expression evaluates to a new table with additional values.
.Retrieve the `+satellites+` table with two rows inserted
[example]
====
[source,gensql]
[gensql]
----
INSERT INTO satellites
(Users, Apogee_km, Perigee_km) VALUES
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/partials/base/table-expressions/joins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Join expressions combine columns from two tables into a new table.

[example]
====
[source,gensql]
[gensql]
----
satellites CROSS JOIN launch_sites
----
Expand All @@ -16,7 +16,7 @@ satellites CROSS JOIN launch_sites

[example]
====
[source,gensql]
[gensql]
----
satellites INNER JOIN launch_sites
ON satellites.Launch_Site = launch_sites.Launch_Site
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tables can be expressed literally using the `+VALUES+` keyword.

[example]
====
[source,gensql]
[gensql]
----
(Users, Apogee_km, Perigee_km) VALUES
("Military", 36012, 35559),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Table expressions can be renamed with the `+AS+` keyword.

[example]
====
[source,gensql]
[gensql]
----
(Launch_Site, State) VALUES
("Cape Canaveral", "Florida"),
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/partials/base/table-expressions/select.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `+SELECT+` expression evaluates a <<Scalar expressions,scalar expression>> i
.Retrieving an entire table
[example]
====
[source,gensql]
[gensql]
----
SELECT * FROM satellites
----
Expand All @@ -15,7 +15,7 @@ SELECT * FROM satellites
.Retrieve a subset of a table's columns
[example]
====
[source,gensql]
[gensql]
----
SELECT Users, Apogee_km, Perigee_km FROM satellites
----
Expand All @@ -24,7 +24,7 @@ SELECT Users, Apogee_km, Perigee_km FROM satellites
.Exclude a subset of a table's columns
[example]
====
[source,gensql]
[gensql]
----
SELECT * EXCEPT Contractor, Country_of_Operator FROM satellites
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The `+UPDATE+` expression evaluates to the a copy of a table with a set of chang
.Retrieve the `+satellites+` table with a launch site renamed
[example]
====
[source,gensql]
[gensql]
----
UPDATE satellites
SET Launch_Site = "Majestic Cape Canaveral"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.Compute the probability of the satellite's period from the model, given the class of orbit.
[example]
====
[source,gensql]
[gensql]
----
SELECT
PROBABILITY OF Period_minutes
Expand All @@ -16,7 +16,7 @@ FROM satellites
.Compute the probability of the satellite's period from the model, given everything but the period, contractor, and operator's country.
[example]
====
[source,gensql]
[gensql]
----
SELECT
PROBABILITY OF Period_minutes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[example]
====
[source,gensql]
[gensql]
----
SELECT
MUTUAL INFORMATION OF Apogee_km < 1000
Expand All @@ -14,7 +14,7 @@ FROM satellites

[example]
====
[source,gensql]
[gensql]
----
SELECT
MUTUAL INFORMATION OF Apogee_km
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[example]
====
[source,gensql]
[gensql]
----
SELECT PROBABILITY OF Period_minutes UNDER satellites_model
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+CREATE MODEL+` statement assigns a name to a model so it can be referenced

[example]
====
[source,gensql]
[gensql]
----
CREATE MODEL military_model AS satellites_model GIVEN Users = "Military"!
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WARNING: The tables returned by `+GENERATE+` are infinite. A query comprised of
.Generate 10 rows of 3 columns from the model
[example]
====
[source,gensql]
[gensql]
----
SELECT *
FROM
Expand All @@ -23,7 +23,7 @@ LIMIT 10
.Generate 10 rows containing almost all columns from the model, but excluding 2
[example]
====
[source,gensql]
[gensql]
----
SELECT *
FROM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+GENERATIVE JOIN+` expression evaluates to a table by combining a model and

[example]
====
[source,gensql]
[gensql]
----
satellites GENERATIVE JOIN satellites_model GIVEN Users AND Apogee_km AND Perigee_km
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+WITH+` keyword allows you to bind names to values for the lifetime of a qu

[example]
====
[source,gensql]
[gensql]
----
WITH (satellites_model GIVEN Users = "Military") AS military_model:
SELECT PROBABILITY OF Apogee_km UNDER military_model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.Compute the probability density of a model variable after conditioning on another variable
[example]
====
[source,gensql]
[gensql]
----
SELECT
PROBABILITY DENSITY OF VAR Apogee_km < 1000
Expand All @@ -16,7 +16,7 @@ FROM satellites_model
.Compute the probability density of a model variable after conditioning on all other variables except one
[example]
====
[source,gensql]
[gensql]
----
SELECT
PROBABILITY DENSITY OF VAR Apogee_km < 1000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[example]
====
[source,gensql]
[gensql]
----
SELECT
PROBABILITY OF VAR Users = "Military"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[example]
====
[source,gensql]
[gensql]
----
SELECT
MUTUAL INFORMATION OF VAR Apogee_km < 1000
Expand All @@ -16,7 +16,7 @@ FROM satellites

[example]
====
[source,gensql]
[gensql]
----
SELECT
APPROXIMATE MUTUAL INFORMATION OF VAR Apogee_km
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[example]
====
[source,gensql]
[gensql]
----
SELECT PROBABILITY OF VAR Apogee_km > Apogee_km UNDER military_model
----
Expand All @@ -12,7 +12,7 @@ SELECT PROBABILITY OF VAR Apogee_km > Apogee_km UNDER military_model

[example]
====
[source,gensql]
[gensql]
----
SELECT PROBABILITY DENSITY OF VAR Apogee_km < 1000
UNDER model CONDITIONED BY VAR Users = "Military"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+CREATE MODEL+` statement assigns a name to a model so it can be referenced

[example]
====
[source,gensql]
[gensql]
----
CREATE MODEL military_model AS model CONDITIONED BY VAR Users = "Military"!
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WARNING: The tables returned by `+GENERATE+` are infinite. A query comprised of
.Generate 10 rows of three columns from the model
[example]
====
[source,gensql]
[gensql]
----
SELECT *
FROM
Expand All @@ -23,7 +23,7 @@ LIMIT 10
.Generate 10 rows containing almost all columns from the model, but excluding 2
[example]
====
[source,gensql]
[gensql]
----
SELECT *
FROM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+GENERATIVE JOIN+` expression evaluates to a table by combining a model and

[example]
====
[source,gensql]
[gensql]
----
satellites GENERATIVE JOIN satellites_model CONDITIONED BY VAR Users = Users AND VAR Apogee_km = Apogee_km AND VAR Perigee_km = Perigee_km
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `+WITH+` keyword allows you to bind names to values for the lifetime of a qu

[example]
====
[source,gensql]
[gensql]
----
WITH (satellites_model CONDITIONED BY VAR Users = "Military") AS military_model:
SELECT PROBABILITY OF VAR Apogee_km > Apogee_km UNDER military_model
Expand Down
Loading