execsql2 2.17.3__py3-none-any.whl → 2.18.0__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.
Files changed (52) hide show
  1. execsql/cli/__init__.py +13 -1
  2. execsql/cli/lint.py +16 -565
  3. execsql/cli/run.py +29 -2
  4. execsql/config.py +20 -0
  5. execsql/db/access.py +6 -0
  6. execsql/db/base.py +57 -1
  7. execsql/db/dsn.py +19 -9
  8. execsql/db/firebird.py +6 -0
  9. execsql/db/mysql.py +81 -0
  10. execsql/db/oracle.py +6 -0
  11. execsql/db/sqlite.py +37 -18
  12. execsql/db/sqlserver.py +31 -6
  13. execsql/exporters/base.py +1 -1
  14. execsql/exporters/duckdb.py +8 -4
  15. execsql/exporters/ods.py +11 -0
  16. execsql/exporters/sqlite.py +10 -3
  17. execsql/exporters/templates.py +10 -0
  18. execsql/exporters/xls.py +4 -0
  19. execsql/exporters/xlsx.py +9 -0
  20. execsql/importers/json.py +49 -32
  21. execsql/metacommands/conditions.py +7 -2
  22. execsql/metacommands/io_export.py +21 -26
  23. execsql/metacommands/io_fileops.py +21 -3
  24. execsql/metacommands/io_import.py +23 -3
  25. execsql/script/ast.py +8 -0
  26. execsql/script/engine.py +32 -0
  27. execsql/script/executor.py +12 -0
  28. execsql/script/variables.py +41 -15
  29. execsql/utils/auth.py +49 -1
  30. execsql/utils/fileio.py +120 -0
  31. execsql/utils/gui.py +11 -1
  32. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/md_compare.sql +12 -12
  33. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/md_glossary.sql +5 -5
  34. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/md_upsert.sql +13 -13
  35. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/pg_compare.sql +24 -24
  36. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/pg_glossary.sql +5 -5
  37. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/pg_upsert.sql +29 -29
  38. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/script_template.sql +2 -2
  39. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/ss_compare.sql +24 -24
  40. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/ss_glossary.sql +6 -6
  41. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/ss_upsert.sql +2917 -2917
  42. {execsql2-2.17.3.dist-info → execsql2-2.18.0.dist-info}/METADATA +6 -1
  43. {execsql2-2.17.3.dist-info → execsql2-2.18.0.dist-info}/RECORD +52 -52
  44. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/README.md +0 -0
  45. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/config_settings.sqlite +0 -0
  46. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/example_config_prompt.sql +0 -0
  47. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/execsql.conf +0 -0
  48. {execsql2-2.17.3.data → execsql2-2.18.0.data}/data/execsql2_extras/make_config_db.sql +0 -0
  49. {execsql2-2.17.3.dist-info → execsql2-2.18.0.dist-info}/WHEEL +0 -0
  50. {execsql2-2.17.3.dist-info → execsql2-2.18.0.dist-info}/entry_points.txt +0 -0
  51. {execsql2-2.17.3.dist-info → execsql2-2.18.0.dist-info}/licenses/LICENSE.txt +0 -0
  52. {execsql2-2.17.3.dist-info → execsql2-2.18.0.dist-info}/licenses/NOTICE +0 -0
@@ -189,12 +189,12 @@ into temporary table ups_ctrl_invl_schema
189
189
  from
190
190
  (
191
191
  select
192
- '!!#base_schema!!' as schema_name,
192
+ !'!#base_schema!'! as schema_name,
193
193
  'base' as schema_type
194
194
  union
195
195
  select
196
196
 
197
- '!!#staging!!' as schema_name,
197
+ !'!#staging!'! as schema_name,
198
198
  'staging' as schema_type
199
199
  ) as schemas
200
200
  left join information_schema.schemata as iss on schemas.schema_name=iss.schema_name
@@ -252,15 +252,15 @@ having count(*)>0
252
252
  from
253
253
  (
254
254
  select
255
- '!!#base_schema!!' as schema_name,
255
+ !'!#base_schema!'! as schema_name,
256
256
  'base' as schema_type,
257
- '!!#table!!' as table_name
257
+ !'!#table!'! as table_name
258
258
  union
259
259
  select
260
260
 
261
- '!!#staging!!' as schema_name,
261
+ !'!#staging!'! as schema_name,
262
262
  'staging' as schema_type,
263
- '!!#table!!' as table_name
263
+ !'!#table!'! as table_name
264
264
  ) as tt
265
265
  left join information_schema.tables as iss on tt.schema_name=iss.table_schema and tt.table_name=iss.table_name
266
266
  where
@@ -336,8 +336,8 @@ having count(*)>0
336
336
  -- !x! if(is_null("!!~err_info!!"))
337
337
  drop table if exists ups_validate_control cascade;
338
338
  select
339
- cast('!!#base_schema!!' as text) as base_schema,
340
- cast('!!#staging!!' as text) as staging_schema,
339
+ cast(!'!#base_schema!'! as text) as base_schema,
340
+ cast(!'!#staging!'! as text) as staging_schema,
341
341
  table_name,
342
342
  False as base_exists,
343
343
  False as staging_exists
@@ -500,7 +500,7 @@ create temporary table !!#control_table!! (
500
500
  insert into !!#control_table!!
501
501
  (table_name)
502
502
  select
503
- trim(regexp_split_to_table('!!#table_list!!', E'\\s*,\\s*')) as table_name;
503
+ trim(regexp_split_to_table(!'!#table_list!'!, E'\\s*,\\s*')) as table_name;
504
504
 
505
505
 
506
506
  -- !x! END SCRIPT
@@ -684,8 +684,8 @@ into
684
684
  from
685
685
  information_schema.columns
686
686
  where
687
- table_schema = '!!#base_schema!!'
688
- and table_name = '!!#table!!'
687
+ table_schema = !'!#base_schema!'!
688
+ and table_name = !'!#table!'!
689
689
  and is_nullable = 'NO'
690
690
  and column_default is null
691
691
  !!~omitnull!!
@@ -855,8 +855,8 @@ inner join information_schema.key_column_usage as k
855
855
  and tc.table_name = k.table_name
856
856
  and tc.constraint_name = k.constraint_name
857
857
  where
858
- k.table_name = '!!#table!!'
859
- and k.table_schema = '!!#base_schema!!'
858
+ k.table_name = !'!#table!'!
859
+ and k.table_schema = !'!#base_schema!'!
860
860
  order by k.ordinal_position
861
861
  ;
862
862
 
@@ -1041,8 +1041,8 @@ into
1041
1041
  from
1042
1042
  ups_foreign_key_columns
1043
1043
  where
1044
- table_schema = '!!#base_schema!!'
1045
- and table_name = '!!#table!!';
1044
+ table_schema = !'!#base_schema!'!
1045
+ and table_name = !'!#table!'!;
1046
1046
 
1047
1047
  -- Create a temporary table of all unique constraint names for
1048
1048
  -- this table, with an integer column to be populated with the
@@ -1290,10 +1290,10 @@ into temporary table ups_cols
1290
1290
  from information_schema.columns as s
1291
1291
  inner join information_schema.columns as b on s.column_name=b.column_name
1292
1292
  where
1293
- s.table_schema = '!!#staging!!'
1294
- and s.table_name = '!!#table!!'
1295
- and b.table_schema = '!!#base_schema!!'
1296
- and b.table_name = '!!#table!!'
1293
+ s.table_schema = !'!#staging!'!
1294
+ and s.table_name = !'!#table!'!
1295
+ and b.table_schema = !'!#base_schema!'!
1296
+ and b.table_name = !'!#table!'!
1297
1297
  !!~col_excl!!
1298
1298
  order by s.ordinal_position;
1299
1299
 
@@ -1313,8 +1313,8 @@ inner join information_schema.key_column_usage as k
1313
1313
  and tc.table_name = k.table_name
1314
1314
  and tc.constraint_name = k.constraint_name
1315
1315
  where
1316
- k.table_name = '!!#table!!'
1317
- and k.table_schema = '!!#base_schema!!'
1316
+ k.table_name = !'!#table!'!
1317
+ and k.table_schema = !'!#base_schema!'!
1318
1318
  order by k.ordinal_position;
1319
1319
 
1320
1320
  -- Get all base table columns that are to be updated into a comma-delimited list.
@@ -1583,7 +1583,7 @@ from
1583
1583
  where
1584
1584
  tc.constraint_type = 'FOREIGN KEY'
1585
1585
  and tc.table_name <> tu.table_name
1586
- and tc.table_schema = '!!#base_schema!!';
1586
+ and tc.table_schema = !'!#base_schema!'!;
1587
1587
 
1588
1588
 
1589
1589
  -- Create a list of tables in the base schema ordered by dependency.
@@ -1644,7 +1644,7 @@ from (
1644
1644
  left join ups_dependencies as p on t.table_name=p.parent
1645
1645
  left join ups_dependencies as c on t.table_name=c.child
1646
1646
  where
1647
- t.table_schema = '!!#base_schema!!'
1647
+ t.table_schema = !'!#base_schema!'!
1648
1648
  and t.table_type = 'BASE TABLE'
1649
1649
  and p.parent is null
1650
1650
  and c.child is null
@@ -2062,8 +2062,8 @@ inner join information_schema.key_column_usage as k
2062
2062
  and tc.table_name = k.table_name
2063
2063
  and tc.constraint_name = k.constraint_name
2064
2064
  where
2065
- k.table_name = '!!#table!!'
2066
- and k.table_schema = '!!#base_schema!!'
2065
+ k.table_name = !'!#table!'!
2066
+ and k.table_schema = !'!#base_schema!'!
2067
2067
  ;
2068
2068
 
2069
2069
 
@@ -2273,7 +2273,7 @@ where
2273
2273
  select table_name, column_name
2274
2274
  from information_schema.columns
2275
2275
  where
2276
- table_schema = '!!#staging!!'
2276
+ table_schema = !'!#staging!'!
2277
2277
  ) as stag on pk.table_name=stag.table_name and pk.newpk_col=stag.column_name
2278
2278
  where
2279
2279
  stag.column_name is null
@@ -2605,7 +2605,7 @@ where
2605
2605
  (
2606
2606
  select
2607
2607
  cons.conname as fk_constraint,
2608
- '!!#staging!!' as staging_schema,
2608
+ !'!#staging!'! as staging_schema,
2609
2609
  ns1.nspname as table_schema,
2610
2610
  cls1.relname as table_name,
2611
2611
  cons.conrelid as table_id,
@@ -2619,8 +2619,8 @@ where
2619
2619
 
2620
2620
  where
2621
2621
  cons.contype='f'
2622
- and ns1.nspname = '!!#base_schema!!'
2623
- and cls1.relname = '!!#table!!'
2622
+ and ns1.nspname = !'!#base_schema!'!
2623
+ and cls1.relname = !'!#table!'!
2624
2624
  ) as fkinf
2625
2625
  inner join pg_class as cls2 on cls2.oid=fkinf.parent_table_id
2626
2626
  inner join pg_namespace ns2 on ns2.oid = cls2.relnamespace
@@ -226,8 +226,8 @@ create schema if not exists !!staging!!;
226
226
  -- !x! write "User: !!$DB_USER!!" to !!logfile!!
227
227
  -- !x! write "Run at: !!$CURRENT_TIME!!" to !!logfile!!
228
228
  -- !x! write "Run ID: !!$RUN_ID!!" to !!logfile!!
229
- -- !x! write "Committing: !!do_commit!! to !!logfile!!
230
- -- !x! write "Cleaning up: !!do_cleanup!! to !!logfile!!
229
+ -- !x! write "Committing: !!do_commit!!" to !!logfile!!
230
+ -- !x! write "Cleaning up: !!do_cleanup!!" to !!logfile!!
231
231
  -- !x! if(sub_defined(metadata_comment))
232
232
  -- !x! write "" to !!logfile!!
233
233
  -- !x! write "!!metadata_comment!!" to !!logfile!!
@@ -117,8 +117,8 @@ inner join information_schema.key_column_usage as k
117
117
  and tc.table_name = k.table_name
118
118
  and tc.constraint_name = k.constraint_name
119
119
  where
120
- k.table_name = '!!#table!!'
121
- and k.table_schema = '!!#base_schema!!'
120
+ k.table_name = !'!#table!'!
121
+ and k.table_schema = !'!#base_schema!'!
122
122
  order by k.ordinal_position
123
123
  ;
124
124
 
@@ -140,10 +140,10 @@ from information_schema.columns as s
140
140
  inner join information_schema.columns as b on s.column_name=b.column_name
141
141
  left join #cmp_primary_key_columns as pk on pk.column_name = s.column_name
142
142
  where
143
- s.table_schema = '!!#staging!!'
144
- and s.table_name = '!!#table!!'
145
- and b.table_schema = '!!#base_schema!!'
146
- and b.table_name = '!!#table!!'
143
+ s.table_schema = !'!#staging!'!
144
+ and s.table_name = !'!#table!'!
145
+ and b.table_schema = !'!#base_schema!'!
146
+ and b.table_name = !'!#table!'!
147
147
  and pk.column_name is null
148
148
  !!~col_sel!!
149
149
  order by s.ordinal_position;
@@ -257,8 +257,8 @@ inner join information_schema.key_column_usage as k
257
257
  and tc.table_name = k.table_name
258
258
  and tc.constraint_name = k.constraint_name
259
259
  where
260
- k.table_name = '!!#table!!'
261
- and k.table_schema = '!!#base_schema!!'
260
+ k.table_name = !'!#table!'!
261
+ and k.table_schema = !'!#base_schema!'!
262
262
  order by k.ordinal_position
263
263
  ;
264
264
 
@@ -280,10 +280,10 @@ from information_schema.columns as s
280
280
  inner join information_schema.columns as b on s.column_name=b.column_name
281
281
  left join #cmp_primary_key_columns as pk on pk.column_name = s.column_name
282
282
  where
283
- s.table_schema = '!!#staging!!'
284
- and s.table_name = '!!#table!!'
285
- and b.table_schema = '!!#base_schema!!'
286
- and b.table_name = '!!#table!!'
283
+ s.table_schema = !'!#staging!'!
284
+ and s.table_name = !'!#table!'!
285
+ and b.table_schema = !'!#base_schema!'!
286
+ and b.table_name = !'!#table!'!
287
287
  and pk.column_name is null
288
288
  !!~col_sel!!
289
289
  order by s.ordinal_position;
@@ -398,8 +398,8 @@ inner join information_schema.key_column_usage as k
398
398
  and tc.table_name = k.table_name
399
399
  and tc.constraint_name = k.constraint_name
400
400
  where
401
- k.table_name = '!!#table!!'
402
- and k.table_schema = '!!#base_schema!!'
401
+ k.table_name = !'!#table!'!
402
+ and k.table_schema = !'!#base_schema!'!
403
403
  order by k.ordinal_position
404
404
  ;
405
405
 
@@ -421,10 +421,10 @@ from information_schema.columns as s
421
421
  inner join information_schema.columns as b on s.column_name=b.column_name
422
422
  left join #cmp_primary_key_columns as pk on pk.column_name = s.column_name
423
423
  where
424
- s.table_schema = '!!#staging!!'
425
- and s.table_name = '!!#table!!'
426
- and b.table_schema = '!!#base_schema!!'
427
- and b.table_name = '!!#table!!'
424
+ s.table_schema = !'!#staging!'!
425
+ and s.table_name = !'!#table!'!
426
+ and b.table_schema = !'!#base_schema!'!
427
+ and b.table_name = !'!#table!'!
428
428
  !!~col_sel!!
429
429
  order by s.ordinal_position;
430
430
 
@@ -548,8 +548,8 @@ inner join information_schema.key_column_usage as k
548
548
  and tc.table_name = k.table_name
549
549
  and tc.constraint_name = k.constraint_name
550
550
  where
551
- k.table_name = '!!#table!!'
552
- and k.table_schema = '!!#base_schema!!'
551
+ k.table_name = !'!#table!'!
552
+ and k.table_schema = !'!#base_schema!'!
553
553
  order by k.ordinal_position
554
554
  ;
555
555
 
@@ -571,10 +571,10 @@ from information_schema.columns as s
571
571
  inner join information_schema.columns as b on s.column_name=b.column_name
572
572
  left join #cmp_primary_key_columns as pk on pk.column_name = s.column_name
573
573
  where
574
- s.table_schema = '!!#staging!!'
575
- and s.table_name = '!!#table!!'
576
- and b.table_schema = '!!#base_schema!!'
577
- and b.table_name = '!!#table!!'
574
+ s.table_schema = !'!#staging!'!
575
+ and s.table_name = !'!#table!'!
576
+ and b.table_schema = !'!#base_schema!'!
577
+ and b.table_name = !'!#table!'!
578
578
  !!~col_sel!!
579
579
  order by s.ordinal_position;
580
580
 
@@ -97,7 +97,7 @@ agg as
97
97
  one.row_num=1
98
98
  UNION ALL
99
99
  select
100
- agg.agg_string + '!!#delimiter!!' + enum.agg_string as agg_string,
100
+ agg.agg_string + !'!#delimiter!'! + enum.agg_string as agg_string,
101
101
  enum.row_num
102
102
  from
103
103
  agg, enum
@@ -215,7 +215,7 @@ with itemtable as (
215
215
  else rtrim(ltrim(substring(column_string, charindex(',', column_string)+1, len(column_string))))
216
216
  end as remaining_list
217
217
  from
218
- (select '!!#column_list!!' as column_string) as ts
218
+ (select !'!#column_list!'! as column_string) as ts
219
219
  UNION ALL
220
220
  select
221
221
  case when charindex(',', remaining_list) = 0
@@ -325,7 +325,7 @@ drop table gls_newentries;
325
325
  select
326
326
  inp.item, inp.definition, inp.url
327
327
  from
328
- (select cast('!!#item!!' as varchar(max)) as item, cast('!!#definition!!' as varchar(max)) as definition, cast('!!#def_url!!' as varchar(max)) as url) as inp
328
+ (select cast(!'!#item!'! as varchar(max)) as item, cast(!'!#definition!'! as varchar(max)) as definition, cast(!'!#def_url!'! as varchar(max)) as url) as inp
329
329
  left join gls_glossary as g on g.!!gls_name!! = inp.item
330
330
  where
331
331
  g.!!gls_name!! is null;
@@ -334,7 +334,7 @@ drop table gls_newentries;
334
334
  select
335
335
  inp.item, inp.definition
336
336
  from
337
- (select cast('!!#item!!' as varchar(max)) as item, cast('!!#definition!!' as varchar(max)) as definition) as inp
337
+ (select cast(!'!#item!'! as varchar(max)) as item, cast(!'!#definition!'! as varchar(max)) as definition) as inp
338
338
  left join gls_glossary as g on g.!!gls_name!! = inp.item
339
339
  where
340
340
  g.!!gls_name!! is null;
@@ -384,8 +384,8 @@ drop view if exists gls_collist;
384
384
  from
385
385
  information_schema.columns
386
386
  where
387
- table_name = '!!#table!!'
388
- and table_schema = '!!#schema!!'
387
+ table_name = !'!#table!'!
388
+ and table_schema = !'!#schema!'!
389
389
  ;
390
390
  -- !x! endif
391
391
  -- !x! sub_empty ~collist