mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Global input_encoding configuration, per-section datestyle configuration, fixes.
This commit is contained in:
parent
5cbd3531aa
commit
e9b884cb4e
13
pgloader.py
13
pgloader.py
@ -187,10 +187,19 @@ def parse_config(conffile):
|
||||
connect = False)
|
||||
|
||||
if config.has_option(section, 'client_encoding'):
|
||||
dbconn.client_encoding = config.get(section, 'client_encoding')
|
||||
client_encoding = pgloader.tools.parse_config_string(
|
||||
config.get(section, 'client_encoding'))
|
||||
dbconn.client_encoding = client_encoding
|
||||
|
||||
if config.has_option(section, 'input_encoding'):
|
||||
input_encoding = pgloader.tools.parse_config_string(
|
||||
config.get(section, 'input_encoding'))
|
||||
pgloader.options.INPUT_ENCODING = input_encoding
|
||||
|
||||
if config.has_option(section, 'datestyle'):
|
||||
dbconn.datestyle = config.get(section, 'datestyle')
|
||||
datestyle = pgloader.tools.parse_config_string(
|
||||
config.get(section, 'datestyle'))
|
||||
dbconn.datestyle = datestyle
|
||||
|
||||
if config.has_option(section, 'copy_every'):
|
||||
dbconn.copy_every = config.getint(section, 'copy_every')
|
||||
|
||||
@ -290,8 +290,6 @@ class db:
|
||||
# ie. we always issue COPY table (col1, col2, ..., coln) commands
|
||||
tablename = table
|
||||
table = "%s (%s) " % (table, ", ".join(columnlist))
|
||||
if DEBUG:
|
||||
print 'COPY %s' % table
|
||||
|
||||
if EOF or self.running_commands == self.copy_every \
|
||||
and self.buffer is not None:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Some common options, for each module to get them
|
||||
|
||||
PGLOADER_VERSION = '2.2.3'
|
||||
PGLOADER_VERSION = '2.2.4-dev'
|
||||
|
||||
INPUT_ENCODING = None
|
||||
PG_CLIENT_ENCODING = 'latin9'
|
||||
|
||||
@ -77,7 +77,7 @@ class PGLoader:
|
||||
print "client_encoding: '%s'" % self.db.client_encoding
|
||||
|
||||
# optionnal local option input_encoding
|
||||
self.input_encoding = None
|
||||
self.input_encoding = INPUT_ENCODING
|
||||
if config.has_option(name, 'input_encoding'):
|
||||
self.input_encoding = parse_config_string(
|
||||
config.get(name, 'input_encoding'))
|
||||
@ -87,7 +87,8 @@ class PGLoader:
|
||||
|
||||
# optionnal local option datestyle
|
||||
if config.has_option(name, 'datestyle'):
|
||||
self.db.datestyle = config.get(name, 'datestyle')
|
||||
self.db.datestyle = parse_config_string(
|
||||
config.get(name, 'datestyle'))
|
||||
|
||||
if DEBUG and not DRY_RUN:
|
||||
print "datestyle: '%s'" % self.db.datestyle
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user