execsql2 1.130.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,250 @@
1
+ -- make_config_db.sql
2
+ --
3
+ -- PURPOSE
4
+ -- Make a SQLite data table that can be used to drive a dialog box
5
+ -- to modify settings.
6
+ --
7
+ -- NOTES
8
+ -- 1. The initial connnection should be made to the SQLite
9
+ -- database to be used.
10
+ --
11
+ -- AUTHOR
12
+ -- Dreas Nielsen (RDN)
13
+ --
14
+ -- HISTORY
15
+ -- Date Remarks
16
+ -- ---------- -----------------------------------------------------
17
+ -- 2020-02-15 Created. RDN.
18
+ -- 2020-02-22 Added settings for GUI_LEVEL and SCAN_LINES. RDN.
19
+ -- 2020-07-08 Added setting for IMPORT_ROW_BUFFER. RDN.
20
+ -- 2020-07-18 Added setting for DEDUP_COLUMN_HEADERS. RDN.
21
+ -- 2020-11-08 Added settings for ONLY_STRINGS. RDN.
22
+ -- 2020-11-14 Added settings for CONFIG CONSOLE HEIGHT and ...WIDTH. RDN.
23
+ -- 2021-02-15 Added settings for CREATE_COLUMN_HEADERS and ZIP_BUFFER_MB. RDN.
24
+ -- 2021-09-19 Added settings for REPLACE_NEWLINES and TRIM_STRINGS. RDN.
25
+ -- 2023-08-25 Added settings for DELETE_EMPTY_COLUMNS, FOLD_COLUMN_HEADERS,
26
+ -- TRIM_COLUMN_HEADERS, WRITE_PREFIX, and WRITE_SUFFIX. RDN.
27
+ -- ==================================================================
28
+
29
+
30
+
31
+ drop table if exists configspecs;
32
+ create table configspecs (
33
+ sub_var text not null,
34
+ prompt text not null,
35
+ initial_value text,
36
+ entry_type text,
37
+ width integer,
38
+ validation_regex text,
39
+ sequence integer,
40
+ constraint pk_conf primary key (sub_var)
41
+ );
42
+
43
+ insert into configspecs
44
+ (sub_var, prompt, initial_value, entry_type, validation_regex, sequence)
45
+ values
46
+ ('~boolean_int', 'Values of 0 and 1 are considered Boolean on import',
47
+ 1, 'checkbox', null, 1),
48
+ ('~boolean_words', 'Values of Y, N, T, and F are considered Boolean on import',
49
+ 1, 'checkbox', null, 2),
50
+ ('~clean_column_headers', 'Replace non-alphanumerics in column headers with underscores on import',
51
+ 0, 'checkbox', null, 3),
52
+ ('~trim_col_hdrs', 'Remove spaces and underscores from column headers (none, left, right, both)',
53
+ 'none', null, null, 4),
54
+ ('~create_column_headers', 'Create missing column headers',
55
+ 0, 'checkbox', null, 5),
56
+ ('~delete_empty_columns', 'Delete entire columns that are missing column headers',
57
+ 0, 'checkbox', null, 6),
58
+ ('~dedup_col_hdrs', 'Make repeated column headers unique by appending an underscore and column number on import',
59
+ 0, 'checkbox', null, 7),
60
+ ('~import_common', 'Import only columns present in both source and destination',
61
+ 0, 'checkbox', null, 8),
62
+ ('~empty_strings', 'Empty strings ('''') in imported data will be preserved, not replaced with NULL',
63
+ 1, 'checkbox', null, 9),
64
+ ('~empty_rows', 'Empty rows in imported data will be preserved',
65
+ 1, 'checkbox', null, 10),
66
+ ('~fold_col_hdrs', 'Fold column headers of imported data (no, lower, or upper)',
67
+ 'no', null, null, 11),
68
+ ('~replace_newlines', 'Newlines in imported data will be replaced with a space.',
69
+ 0, 'checkbox', null, 12),
70
+ ('~trim_strings', 'Leading and trailing whitespace on imported strings will be removed.',
71
+ 0, 'checkbox', null, 13),
72
+ ('~scan_lines', 'Number of lines of a text file to scan for delimiters during import',
73
+ 100, null, '[1-9][0-9]*', 14),
74
+ ('~import_row_buffer', 'Number of rows of input data to buffer for the IMPORT metacommand',
75
+ 1000, null, '[1-9][0-9]*', 15),
76
+ ('~make_dirs', 'Create directories if necessary for export files',
77
+ 0, 'checkbox', null, 16),
78
+ ('~quote_all', 'Quote all text values on output',
79
+ 0, 'checkbox', null, 17),
80
+ ('~export_row_buffer', 'Number of data rows to buffer during export',
81
+ 1000, null, '[1-9][0-9]*', 18),
82
+ ('~hdf5_len', 'Length of text columns for HDF5 output',
83
+ 1000, null, null, 18),
84
+ ('~console_height', 'Approximate height of a console window',
85
+ 25, null, '[1-9][0-9]*', 20),
86
+ ('~console_width', 'Approximate width of a console window',
87
+ 100, null, '[1-9][0-9]*', 21),
88
+ ('~console_wait_done', 'Leave execsql''s console open when script is complete',
89
+ 0, 'checkbox', null, 22),
90
+ ('~console_wait_err', 'Leave execsql''s console open when an error occurs',
91
+ 0, 'checkbox', null, 23),
92
+ ('~log_write', 'Echo all output of the ''write'' metacommand to execsql.log',
93
+ 0, 'checkbox', null, 24),
94
+ ('~gui_level', 'Use GUI dialogs for user interaction',
95
+ 0, null, '[0-2]', 25),
96
+ ('~only_strings', 'Import all data columns as text',
97
+ 0, 'checkbox', null, 26),
98
+ ('~write_prefix', 'Text that will be prefixed to all output of the WRITE metacommand',
99
+ null, null, null, 27),
100
+ ('~write_suffix', 'Text that will be suffixed to all output of the WRITE metacommand',
101
+ null, null, null, 28),
102
+ ('~write_warnings', 'Write warning messages to the console as well as to execsql.log',
103
+ 0, 'checkbox', null, 29),
104
+ ('~log_datavars', 'Write data variable assignments to execsql.log',
105
+ 1, 'checkbox', null, 30),
106
+ ('~zip_buffer_mb', 'Buffer size for zipped exports, in Mb.',
107
+ 10, null, '[1-9][0-9]*', 31),
108
+ ('~dao_flush', 'Delay, in seconds, between use of DAO and ODBC with Access',
109
+ '5.0', null, '[0-9]*\.?[0-9]+', 32)
110
+ ;
111
+ update configspecs set width = 5
112
+ where sub_var in ('~scan_lines', '~dao_flush', '~console_width', '~console_height',
113
+ '~replace_newlines', '~trim_strings', '~zip_buffer_mb');
114
+ update configspecs set width = 7 where sub_var in ('~import_row_buffer', '~export_row_buffer', '~hdf5_len');
115
+ update configspecs set width = 2 where sub_var = '~gui_level';
116
+
117
+ drop table if exists configusage;
118
+ create table configusage (
119
+ usage text not null,
120
+ sub_var text not null,
121
+ constraint pk_usage primary key (usage, sub_var)
122
+ );
123
+
124
+ insert into configusage
125
+ (usage, sub_var)
126
+ values
127
+ ('All', '~boolean_int'),
128
+ ('All', '~boolean_words'),
129
+ ('All', '~clean_column_headers'),
130
+ ('All', '~create_column_headers'),
131
+ ('All', '~dedup_col_hdrs'),
132
+ ('All', '~delete_empty_columns'),
133
+ ('All', '~import_common'),
134
+ ('All', '~empty_strings'),
135
+ ('All', '~empty_rows'),
136
+ ('All', '~fold_col_hdrs'),
137
+ ('All', '~replace_newlines'),
138
+ ('All', '~trim_strings'),
139
+ ('All', '~trim_col_hdrs'),
140
+ ('All', '~scan_lines'),
141
+ ('All', '~console_height'),
142
+ ('All', '~console_width'),
143
+ ('All', '~console_wait_done'),
144
+ ('All', '~console_wait_err'),
145
+ ('All', '~log_write'),
146
+ ('All', '~make_dirs'),
147
+ ('All', '~quote_all'),
148
+ ('All', '~import_row_buffer'),
149
+ ('All', '~export_row_buffer'),
150
+ ('All', '~hdf5_len'),
151
+ ('All', '~gui_level'),
152
+ ('All', '~write_prefix'),
153
+ ('All', '~write_suffix'),
154
+ ('All', '~write_warnings'),
155
+ ('All', '~log_datavars'),
156
+ ('All', '~dao_flush'),
157
+ ('All', '~only_strings'),
158
+ ('All', '~zip_buffer_mb'),
159
+
160
+
161
+ ('AllButDAO', '~boolean_int'),
162
+ ('AllButDAO', '~boolean_words'),
163
+ ('AllButDAO', '~clean_column_headers'),
164
+ ('AllButDAO', '~create_column_headers'),
165
+ ('AllButDAO', '~dedup_col_hdrs'),
166
+ ('AllButDAO', '~delete_empty_columns'),
167
+ ('AllButDAO', '~import_common'),
168
+ ('AllButDAO', '~empty_strings'),
169
+ ('AllButDAO', '~empty_rows'),
170
+ ('AllButDAO', '~fold_col_hdrs'),
171
+ ('AllButDAO', '~replace_newlines'),
172
+ ('AllButDAO', '~trim_strings'),
173
+ ('AllButDAO', '~trim_col_hdrs'),
174
+ ('AllButDAO', '~scan_lines'),
175
+ ('AllButDAO', '~console_height'),
176
+ ('AllButDAO', '~console_width'),
177
+ ('AllButDAO', '~console_wait_done'),
178
+ ('AllButDAO', '~console_wait_err'),
179
+ ('AllButDAO', '~log_write'),
180
+ ('AllButDAO', '~make_dirs'),
181
+ ('AllButDAO', '~quote_all'),
182
+ ('AllButDAO', '~import_row_buffer'),
183
+ ('AllButDAO', '~export_row_buffer'),
184
+ ('AllButDAO', '~hdf5_len'),
185
+ ('AllButDAO', '~gui_level'),
186
+ ('AllButDAO', '~write_prefix'),
187
+ ('AllButDAO', '~write_suffix'),
188
+ ('AllButDAO', '~write_warnings'),
189
+ ('AllButDAO', '~log_datavars'),
190
+ ('AllButDAO', '~only_strings'),
191
+ ('AllButDAO', '~zip_buffer_mb'),
192
+
193
+ ('Import', '~boolean_int'),
194
+ ('Import', '~boolean_words'),
195
+ ('Import', '~clean_column_headers'),
196
+ ('Import', '~create_column_headers'),
197
+ ('Import', '~dedup_col_hdrs'),
198
+ ('Import', '~delete_empty_columns'),
199
+ ('Import', '~empty_strings'),
200
+ ('Import', '~empty_rows'),
201
+ ('Import', '~fold_col_hdrs'),
202
+ ('Import', '~replace_newlines'),
203
+ ('Import', '~trim_strings'),
204
+ ('Import', '~trim_col_hdrs'),
205
+ ('Import', '~import_common'),
206
+ ('Import', '~import_row_buffer'),
207
+ ('Import', '~scan_lines'),
208
+ ('Import', '~only_strings'),
209
+
210
+ ('Export', '~make_dirs'),
211
+ ('Export', '~quote_all'),
212
+ ('Export', '~export_row_buffer'),
213
+ ('Export', '~hdf5_len'),
214
+ ('Export', '~zip_buffer_mb')
215
+ ;
216
+
217
+ drop view if exists all_config;
218
+ create view all_config as
219
+ select cs.*
220
+ from configspecs cs inner join configusage cu
221
+ on cu.sub_var = cs.sub_var
222
+ where
223
+ usage = 'All';
224
+
225
+ drop view if exists allbutdao_config;
226
+ create view allbutdao_config as
227
+ select cs.*
228
+ from configspecs cs inner join configusage cu
229
+ on cu.sub_var = cs.sub_var
230
+ where
231
+ usage = 'AllButDAO';
232
+
233
+ drop view if exists import_config;
234
+ create view import_config as
235
+ select cs.*
236
+ from configspecs cs inner join configusage cu
237
+ on cu.sub_var = cs.sub_var
238
+ where
239
+ usage = 'Import';
240
+
241
+ drop view if exists export_config;
242
+ create view export_config as
243
+ select cs.*
244
+ from configspecs cs inner join configusage cu
245
+ on cu.sub_var = cs.sub_var
246
+ where
247
+ usage = 'Export';
248
+
249
+
250
+