@@ -105,62 +105,90 @@ They will be populated with IDs that reference the new derived tables.
105
105
106
106
## csvs-to-sqlite --help
107
107
108
- Usage: csvs-to-sqlite [OPTIONS] PATHS... DBNAME
109
-
110
- PATHS: paths to individual .csv files or to directories containing .csvs
111
-
112
- DBNAME: name of the SQLite database file to create
113
-
114
- Options:
115
- -s, --separator TEXT Field separator in input .csv
116
- -q, --quoting INTEGER Control field quoting behavior per csv.QUOTE_*
117
- constants. Use one of QUOTE_MINIMAL (0),
118
- QUOTE_ALL (1), QUOTE_NONNUMERIC (2) or
119
- QUOTE_NONE (3).
120
- --skip-errors Skip lines with too many fields instead of
121
- stopping the import
122
- --replace-tables Replace tables if they already exist
123
- -t, --table TEXT Table to use (instead of using CSV filename)
124
- -c, --extract-column TEXT One or more columns to 'extract' into a
125
- separate lookup table. If you pass a simple
126
- column name that column will be replaced with
127
- integer foreign key references to a new table
128
- of that name. You can customize the name of the
129
- table like so:
130
- state:States:state_name
131
- This will pull unique values from the 'state'
132
- column and use them to populate a new 'States'
133
- table, with an id column primary key and a
134
- state_name column containing the strings from
135
- the original column.
136
- -d, --date TEXT One or more columns to parse into ISO formatted
137
- dates
138
- -dt, --datetime TEXT One or more columns to parse into ISO formatted
139
- datetimes
140
- -df, --datetime-format TEXT One or more custom date format strings to try
141
- when parsing dates/datetimes
142
- -pk, --primary-key TEXT One or more columns to use as the primary key
143
- -f, --fts TEXT One or more columns to use to populate a full-
144
- text index
145
- -i, --index TEXT Add index on this column (or a compound index
146
- with -i col1,col2)
147
- --shape TEXT Custom shape for the DB table - format is
148
- csvcol:dbcol(TYPE),...
149
- --filename-column TEXT Add a column with this name and populate with
150
- CSV file name
151
- --fixed-column <TEXT TEXT >... Populate column with a fixed string
108
+ <!-- [[[cog
109
+ import cog
110
+ from csvs_to_sqlite import cli
111
+ from click.testing import CliRunner
112
+ runner = CliRunner()
113
+ result = runner.invoke(cli.cli, ["--help"])
114
+ help = result.output.replace("Usage: cli", "Usage: csvs-to-sqlite")
115
+ cog.out(
116
+ "```\n{}\n```".format(help)
117
+ )
118
+ ]]] -->
119
+ ```
120
+ Usage: csvs-to-sqlite [OPTIONS] PATHS... DBNAME
121
+
122
+ PATHS: paths to individual .csv files or to directories containing .csvs
123
+
124
+ DBNAME: name of the SQLite database file to create
125
+
126
+ Options:
127
+ -s, --separator TEXT Field separator in input .csv
128
+ -q, --quoting INTEGER Control field quoting behavior per csv.QUOTE_*
129
+ constants. Use one of QUOTE_MINIMAL (0),
130
+ QUOTE_ALL (1), QUOTE_NONNUMERIC (2) or
131
+ QUOTE_NONE (3).
132
+
133
+ --skip-errors Skip lines with too many fields instead of
134
+ stopping the import
135
+
136
+ --replace-tables Replace tables if they already exist
137
+ -t, --table TEXT Table to use (instead of using CSV filename)
138
+ -c, --extract-column TEXT One or more columns to 'extract' into a
139
+ separate lookup table. If you pass a simple
140
+ column name that column will be replaced with
141
+ integer foreign key references to a new table
142
+ of that name. You can customize the name of
143
+ the table like so: state:States:state_name
144
+
145
+ This will pull unique values from the 'state'
146
+ column and use them to populate a new 'States'
147
+ table, with an id column primary key and a
148
+ state_name column containing the strings from
149
+ the original column.
150
+
151
+ -d, --date TEXT One or more columns to parse into ISO
152
+ formatted dates
153
+
154
+ -dt, --datetime TEXT One or more columns to parse into ISO
155
+ formatted datetimes
156
+
157
+ -df, --datetime-format TEXT One or more custom date format strings to try
158
+ when parsing dates/datetimes
159
+
160
+ -pk, --primary-key TEXT One or more columns to use as the primary key
161
+ -f, --fts TEXT One or more columns to use to populate a full-
162
+ text index
163
+
164
+ -i, --index TEXT Add index on this column (or a compound index
165
+ with -i col1,col2)
166
+
167
+ --shape TEXT Custom shape for the DB table - format is
168
+ csvcol:dbcol(TYPE),...
169
+
170
+ --filename-column TEXT Add a column with this name and populate with
171
+ CSV file name
172
+
173
+ --fixed-column <TEXT TEXT>... Populate column with a fixed string
152
174
--fixed-column-int <TEXT INTEGER>...
153
- Populate column with a fixed integer
175
+ Populate column with a fixed integer
154
176
--fixed-column-float <TEXT FLOAT>...
155
- Populate column with a fixed float
156
- --no-index-fks Skip adding index to foreign key columns
157
- created using --extract-column (default is to
158
- add them)
159
- --no-fulltext-fks Skip adding full-text index on values extracted
160
- using --extract-column (default is to add them)
161
- --just-strings Import all columns as text strings by default
162
- (and, if specified, still obey --shape,
163
- --date/datetime, and --datetime-format)
164
-
165
- --version Show the version and exit.
166
- --help Show this message and exit.
177
+ Populate column with a fixed float
178
+ --no-index-fks Skip adding index to foreign key columns
179
+ created using --extract-column (default is to
180
+ add them)
181
+
182
+ --no-fulltext-fks Skip adding full-text index on values
183
+ extracted using --extract-column (default is
184
+ to add them)
185
+
186
+ --just-strings Import all columns as text strings by default
187
+ (and, if specified, still obey --shape,
188
+ --date/datetime, and --datetime-format)
189
+
190
+ --version Show the version and exit.
191
+ --help Show this message and exit.
192
+
193
+ ```
194
+ <!-- [[[end]]] -->
0 commit comments