• R/O
  • SSH

execsql: コミット

Default repository for execsql.py


コミットメタ情報

リビジョンa1b18f3240057fb46b2538d4aa37c766f903f027 (tree)
日時2023-03-30 05:49:41
作者Dreas Nielsen <dnielsen@inte...>
コミッターDreas Nielsen

ログメッセージ

Changed Postgres COPY command used with unquoted TSV data.

変更サマリ

差分

diff -r daf29ae1f157 -r a1b18f324005 execsql/execsql.py
--- a/execsql/execsql.py Sun Mar 26 17:47:58 2023 -0700
+++ b/execsql/execsql.py Wed Mar 29 13:49:41 2023 -0700
@@ -27,12 +27,12 @@
2727 #
2828 # ===============================================================================
2929
30-__version__ = "1.113.0"
31-__vdate = "2023-03-26"
30+__version__ = "1.113.1"
31+__vdate = "2023-03-29"
3232
3333 primary_vno = 1
3434 secondary_vno = 113
35-tertiary_vno = 0
35+tertiary_vno = 1
3636
3737 import os
3838 import os.path
@@ -4158,10 +4158,13 @@
41584158 # Copy_from() requires a delimiter, but if there is none, feed it an
41594159 # ASCII unit separator, which, if it had been used for its intended purpose,
41604160 # should have been identified as the delimiter, so presumably it has not been used.
4161- delim = csv_file_obj.delimiter if csv_file_obj.delimiter else chr(31)
4162- copy_cmd = "copy %s (%s) from stdin with (format csv, null '', delimiter '%s'" % (sq_name, input_col_list, delim)
4163- if csv_file_obj.quotechar:
4164- copy_cmd = copy_cmd + ", quote '%s'" % csv_file_obj.quotechar
4161+ if csv_file_obj.delimiter == '\t' and csv_file_obj.quotechar is None:
4162+ copy_cmd = "copy %s (%s) from stdin with (format text, null ''" % (sq_name, input_col_list)
4163+ else:
4164+ delim = csv_file_obj.delimiter if csv_file_obj.delimiter else chr(31)
4165+ copy_cmd = "copy %s (%s) from stdin with (format csv, null '', delimiter '%s'" % (sq_name, input_col_list, delim)
4166+ if csv_file_obj.quotechar:
4167+ copy_cmd = copy_cmd + ", quote '%s'" % csv_file_obj.quotechar
41654168 # psycopg2 or Postgres does not always do the encoding conversion correctly.
41664169 #if input_enc != self.encoding:
41674170 # copy_cmd = copy_cmd + ", encoding '%s'" % input_enc
diff -r daf29ae1f157 -r a1b18f324005 setup.py
--- a/setup.py Sun Mar 26 17:47:58 2023 -0700
+++ b/setup.py Wed Mar 29 13:49:41 2023 -0700
@@ -5,7 +5,7 @@
55 long_description = f.read()
66
77 setuptools.setup(name='execsql',
8- version='1.113.0',
8+ version='1.113.1',
99 description="Runs a SQL script against a PostgreSQL, MS-Access, SQLite, MS-SQL-Server, MySQL, MariaDB, Firebird, or Oracle database, or an ODBC DSN. Provides metacommands to import and export data, copy data between databases, conditionally execute SQL and metacommands, and dynamically alter SQL and metacommands with substitution variables. Data can be exported in 18 different formats, including CSV, TSV, ODS, HTML, JSON, LaTeX, and Markdown tables, and using custom templates.",
1010 author='Dreas Nielsen',
1111 author_email='dreas.nielsen@gmail.com',
旧リポジトリブラウザで表示