MIT License 105 | 106 | Copyright (c) 2018 John David Smith 107 | 108 | Permission is hereby granted, free of charge, to any person obtaining a copy 109 | of this software and associated documentation files (the "Software"), to deal 110 | in the Software without restriction, including without limitation the rights 111 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 112 | copies of the Software, and to permit persons to whom the Software is 113 | furnished to do so, subject to the following conditions: 114 | 115 | The above copyright notice and this permission notice shall be included in all 116 | copies or substantial portions of the Software. 117 | 118 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 119 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 120 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 121 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 122 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 123 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 124 | SOFTWARE. 125 |126 | 127 |
sp_color_markdown_text.Rd
Color subsequent text in a specified color
110 |sp_color_markdown_text(x, color)113 | 114 |
x | 119 |a string |
120 |
---|---|
color | 123 |color to apply |
124 |
colored string
130 | 131 |134 |# sp_color_markdown_text('Cover inline tables in future section','red') 133 |
sp_docker_build.Rd
Creates a Docker image
110 |sp_docker_build(build_options, build_context_path)113 | 114 |
build_options | 119 |character: the build options. There are many; do
120 | |
122 |
---|---|
build_context_path | 125 |character: the build context path |
126 |
Result of Docker command if it succeeded. Stops with an error message 132 | if it failed.
133 | 134 |sp_docker_containers_tibble.Rd
Creates a tibble of containers using docker ps
sp_docker_containers_tibble(list_all = FALSE)113 | 114 |
list_all | 119 |logical: list all containers if |
121 |
---|
A tibble listing the containers. If there are none, 127 | returns an empty (0x0) tibble.
128 | 129 |133 |if (FALSE) { 131 | sp_docker_containers_tibble(list_all = FALSE) 132 | }
sp_docker_images_tibble.Rd
Creates a tibble of images using docker images
sp_docker_images_tibble(list_all = FALSE)113 | 114 |
list_all | 119 |logical: list all images if |
121 |
---|
A tibble listing the images
127 | 128 |132 |if (FALSE) { 130 | sp_docker_images_tibble(list_all = FALSE) 131 | }
sp_docker_network_create.Rd
Creates a Docker network with name network_name
.
sp_docker_network_create(network_name = "sql-pet")113 | 114 |
network_name | 119 |character: network to create. The default is |
120 |
---|
Result of Docker command if it succeeded. Stops with an 126 | error message if it failed.
127 | 128 |130 |if (FALSE) sp_docker_network_create("sql-pet")
sp_docker_networks_tibble.Rd
Creates a tibble of networks using docker network
sp_docker_networks_tibble()
113 |
114 |
115 | A tibble listing the networks
118 | 119 |124 |if (FALSE) { 121 | docker_networks <- sp_docker_networks_tibble() 122 | View(docker_networks) 123 | }
sp_docker_remove_container.Rd
Forcibly removes a Docker container. If it is running it will be 112 | forcibly terminated and removed. If it doesn't exist you won't get an error 113 | message. This is a blunt instrument!
114 |sp_docker_remove_container(docker_container)117 | 118 |
docker_container | 123 |character: the name of the container to 124 | remove |
125 |
---|
a numeric 0
Warning: this function removes the container you asked it to remove!
134 | 135 |137 |if (FALSE) sp_docker_remove_container("sql-pet")
sp_docker_remove_image.Rd
Forcibly removes a Docker image. If it doesn't exist you won't 111 | get an error message. This is a blunt instrument!
112 |sp_docker_remove_image(docker_image)115 | 116 |
docker_image | 121 |character: the name of the image to remove |
122 |
---|
a numeric 0
Warning: this function removes the image you asked it to remove!
131 | 132 |134 |if (FALSE) sp_docker_remove_image("docker.io/postgres:10")
sp_docker_start.Rd
Starts the container given by container_name
.
sp_docker_start(container_name)113 | 114 |
container_name | 119 |character: container to start |
120 |
---|
Result of Docker command if it succeeded. Stops with an 126 | error message if it failed.
127 | 128 |130 |if (FALSE) sp_docker_start("sql-pet")
sp_docker_stop.Rd
Stops the container given by container_name
.
sp_docker_stop(container_name)113 | 114 |
container_name | 119 |character: container to stop |
120 |
---|
Result of Docker command if it succeeded. Stops with an 126 | error message if it failed.
127 | 128 |130 |if (FALSE) sp_docker_stop("sql-pet")
dvdrental
autodoc — sp_fetch_dvdrental_autodoc • sqlpetrdvdrental
autodocsp_fetch_dvdrental_autodoc.Rd
When sp_make_dvdrental_image
builds the Docker image, it
116 | installs a utility called
117 | postgresql-autodoc
. After restoring
118 | the dvdrental
database, it runs the utilily and creates an HTML file with
119 | the database documentation on the image at
120 | /var/lib/postgresql/dvdrental.html
. This function fetches that file to a
121 | file on the Docker host.
sp_fetch_dvdrental_autodoc(container_name = "sql-pet", file_path)125 | 126 |
container_name | 131 |character: The container name where the |
133 |
---|---|
file_path | 136 |character: A valid file path to receive the HTML file. It
137 | should be an absolute path so you know where to find it, and the filename
138 | should end in |
139 |
If successful: a character value of lenght 0. If unsuccessful, the 145 | function terminates with an error message.
146 | 147 |sp_get_dbms_data_dictionary.Rd
Download a table from the dbms and create a data dictionary data frame
110 |sp_get_dbms_data_dictionary(table_name, con = con)113 | 114 |
table_name | 119 |The name of a table to be processed. |
120 |
---|---|
con | 123 |A DBI connection object for obtaining the local copy to be processed |
124 |
a data frame table_dd
133 |if (FALSE) all_meta <- sp_get_dbms_data_dictionary("rental")
sp_get_fivenumsum.Rd
Calculate a 5 number summary (for all types of variables)
110 |sp_get_fivenumsum(var, character_truncate_length = 60)113 | 114 |
var | 119 |The variable to be summarized |
120 |
---|---|
character_truncate_length | 123 |the length of output character summaries (for ) |
124 |
The min, max, median, and 25th and 75th percentiles
130 | 131 |133 |summary_vector <- sp_get_fivenumsum(mtcars$mpg)
sp_make_data_dictionary.Rd
Run sp_get_fivenumsum on all variables in a data frame
110 |sp_make_data_dictionary(df, df_alias = NULL)113 | 114 |
df | 119 |data frame to be summarized |
120 |
---|---|
df_alias | 123 |name of the data frame to be appended |
124 |
a data frame
130 | 131 |133 |table_dd <- sp_make_data_dictionary(mtcars)
dvdrental
Docker image — sp_make_dvdrental_image • sqlpetrdvdrental
Docker imagesp_make_dvdrental_image.Rd
Creates a Docker image with PostgreSQL and the dvdrental
111 | database
sp_make_dvdrental_image(image_tag)115 | 116 |
image_tag | 121 |character: a valid image tag (name) for the docker image |
122 |
---|
Result of Docker command if it succeeded. Stops with an error message 128 | if it failed.
129 |See the vignette "Building the dvdrental
Docker Image" for the
132 | details.
139 |if (FALSE) { 136 | build_log <- sp_make_dvdrental_image("test-dvdrental:latest") 137 | sp_docker_images_tibble() 138 | }
sp_make_simple_pg.Rd
Creates a container and runs the PostgreSQL 10 image
112 | (docker.io/postgres:10
) in it. The image will be downloaded if it doesn't
113 | exist locally.
sp_make_simple_pg(container_name, postgres_password = "postgres")117 | 118 |
container_name | 123 |character: a valid container name for the 124 | container |
125 |
---|---|
postgres_password | 128 |character: superuser password. Default is 129 | "postgres". |
130 |
Result of Docker command if it succeeded. Stops with an 136 | error message if it failed.
137 | 138 |144 |if (FALSE) { 140 | run_log <- sp_make_simple_pg("livestock") 141 | sp_docker_images_tibble() 142 | sp_docker_containers_tibble() 143 | }
sp_pg_close_connection.Rd
Tells the connections tab observer that connection was closed 111 | and then closes it
112 |sp_pg_close_connection(connection)115 | 116 |
connection | 121 |A valid open connection from |
122 |
---|
not meaningful
128 | 129 |sp_print_df.Rd
Show (print) a data frame depending on appropriate output type
110 |sp_print_df(df)113 | 114 |
df | 119 |the data frame to be shown |
120 |
---|
either kable (in PDF) or datatable (in HTML) output
126 | 127 |129 |if (FALSE) sp_print_df(df)
sp_show_all_docker_containers.Rd
Check that docker is running
110 |sp_show_all_docker_containers()
113 |
114 |
115 | 0
118 | 119 |121 |if (FALSE) sp_show_all_docker_containers()