Skip to content

Commit 8d97a31

Browse files
authored
Improve documentation with command lines and defaults. (#1415)
* Improve documentation with command lines and defaults. The advanced documentation coverage skipped the simple approach and didn't explain fully what to do with the sample commands. Fixes #1413. * Fix docs indentation in the MySQL connection string options. * Desultory docs and docs config fixes.
1 parent eeefcaa commit 8d97a31

File tree

16 files changed

+252
-202
lines changed

16 files changed

+252
-202
lines changed

docs/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
#
9393
# html_theme_options = {}
9494
html_theme_options = {
95-
'github_user': 'dimitri',
96-
'github_repo': 'pgloader',
97-
'description': 'your migration companion',
98-
'travis_button': True,
99-
'show_related': True,
95+
#'github_user': 'dimitri',
96+
#'github_repo': 'pgloader',
97+
#'description': 'your migration companion',
98+
#'travis_button': True,
99+
#'show_related': True,
100100
#'sidebar_collapse': False,
101101
}
102102

docs/pgloader-usage-examples.rst

Lines changed: 0 additions & 163 deletions
This file was deleted.

docs/pgloader.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ pgloader templating system::
455455
The mustache templates implementation with OS environment support replaces
456456
former `GETENV` implementation, which didn't work anyway.
457457

458+
.. _common_clauses:
459+
458460
Common Clauses
459461
--------------
460462

docs/ref/archive.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ This command instructs pgloader to load data from one or more files contained
55
in an archive. Currently the only supported archive format is *ZIP*, and the
66
archive might be downloaded from an *HTTP* URL.
77

8-
Here's an example::
8+
Using advanced options and a load command file
9+
----------------------------------------------
10+
11+
The command then would be:
12+
13+
::
14+
15+
$ pgloader archive.load
16+
17+
And the contents of the ``archive.load`` file could be inspired from the
18+
following:
19+
20+
::
921

1022
LOAD ARCHIVE
1123
FROM /Users/dim/Downloads/GeoLiteCity-latest.zip
@@ -61,7 +73,11 @@ Here's an example::
6173
FINALLY DO
6274
$$ create index blocks_ip4r_idx on geolite.blocks using gist(iprange); $$;
6375

64-
The `archive` command accepts the following clauses and options.
76+
Common Clauses
77+
--------------
78+
79+
Please refer to :ref:`common_clauses` for documentation about common
80+
clauses.
6581

6682
Archive Source Specification: FROM
6783
----------------------------------

docs/ref/copy.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@ Loading COPY Formatted Files
22
============================
33

44
This commands instructs pgloader to load from a file containing COPY TEXT
5-
data as described in the PostgreSQL documentation. Here's an example::
5+
data as described in the PostgreSQL documentation.
6+
7+
Using advanced options and a load command file
8+
----------------------------------------------
9+
10+
The command then would be:
11+
12+
::
13+
14+
$ pgloader copy.load
15+
16+
And the contents of the ``copy.load`` file could be inspired from the following:
17+
18+
::
619

720
LOAD COPY
821
FROM copy://./data/track.copy
@@ -33,7 +46,12 @@ data as described in the PostgreSQL documentation. Here's an example::
3346
);
3447
$$;
3548

36-
The `COPY` format command accepts the following clauses and options.
49+
50+
Common Clauses
51+
--------------
52+
53+
Please refer to :ref:`common_clauses` for documentation about common
54+
clauses.
3755

3856
COPY Formatted Files Source Specification: FROM
3957
-----------------------------------------------

docs/ref/csv.rst

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
Loading CSV data
22
================
33

4-
This command instructs pgloader to load data from a `CSV` file. Here's an
5-
example::
4+
This command instructs pgloader to load data from a `CSV` file. Because of
5+
the complexity of guessing the parameters of a CSV file, it's simpler to
6+
instruct pgloader with how to parse the data in there, using the full
7+
pgloader command syntax and CSV specifications as in the following example.
8+
9+
Using advanced options and a load command file
10+
----------------------------------------------
11+
12+
The command then would be:
13+
14+
::
15+
16+
$ pgloader csv.load
17+
18+
And the contents of the ``csv.load`` file could be inspired from the following:
19+
20+
::
621

722
LOAD CSV
823
FROM 'GeoLiteCity-Blocks.csv' WITH ENCODING iso-646-us
@@ -25,7 +40,11 @@ example::
2540

2641
SET work_mem to '32 MB', maintenance_work_mem to '64 MB';
2742

28-
The `csv` format command accepts the following clauses and options.
43+
Common Clauses
44+
--------------
45+
46+
Please refer to :ref:`common_clauses` for documentation about common
47+
clauses.
2948

3049
CSV Source Specification: FROM
3150
------------------------------

docs/ref/dbf.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,33 @@ This command instructs pgloader to load data from a `DBF` file. A default
55
set of casting rules are provided and might be overloaded and appended to by
66
the command.
77

8+
Using advanced options and a load command file
9+
----------------------------------------------
10+
811
Here's an example with a remote HTTP source and some user defined casting
9-
rules::
12+
rules. The command then would be:
13+
14+
::
15+
16+
$ pgloader dbf.load
17+
18+
And the contents of the ``dbf.load`` file could be inspired from the following:
19+
20+
::
1021

1122
LOAD DBF
12-
FROM http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/reg2013.dbf
23+
FROM http://www.insee.fr/fr/methodes/nomenclatures/cog/telechargement/2013/dbf/reg2013.dbf
1324
INTO postgresql://user@localhost/dbname
1425
WITH truncate, create table
1526
CAST column reg2013.region to integer,
1627
column reg2013.tncc to smallint;
1728

18-
The `dbf` format command accepts the following clauses and options.
29+
30+
Common Clauses
31+
--------------
32+
33+
Please refer to :ref:`common_clauses` for documentation about common
34+
clauses.
1935

2036
DBF Source Specification: FROM
2137
------------------------------

docs/ref/fixed.rst

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@ Loading Fixed Cols File Formats
22
===============================
33

44
This command instructs pgloader to load data from a text file containing
5-
columns arranged in a *fixed size* manner. Here's an example::
5+
columns arranged in a *fixed size* manner.
6+
7+
Using advanced options and a load command file
8+
----------------------------------------------
9+
10+
The command then would be:
11+
12+
::
13+
14+
$ pgloader fixed.load
15+
16+
And the contents of the ``fixed.load`` file could be inspired from the following:
17+
18+
::
619

720
LOAD FIXED
821
FROM inline
@@ -41,7 +54,16 @@ columns arranged in a *fixed size* manner. Here's an example::
4154
2345609872014092914371500
4255
2345678902014092914371520
4356

44-
The `fixed` format command accepts the following clauses and options.
57+
Note that the example comes from the test suite of pgloader, where we use
58+
the advanced feature ``FROM inline`` that allows embedding the source data
59+
within the command file. In most cases a more classic FROM clause loading
60+
the data from a separate file would be used.
61+
62+
Common Clauses
63+
--------------
64+
65+
Please refer to :ref:`common_clauses` for documentation about common
66+
clauses.
4567

4668
Fixed File Format Source Specification: FROM
4769
--------------------------------------------

0 commit comments

Comments
 (0)