Build tablename and COPY column list only at COPY time, not for each line

This commit is contained in:
dim 2008-05-28 10:07:45 +00:00
parent b7c7e6a7c1
commit d068b05ae2

View File

@ -413,17 +413,6 @@ ORDER BY attnum
ok = True
if not self.copy: self.copy = True
##
# build the table colomns specs from parameters
# ie. we always issue COPY table (col1, col2, ..., coln) commands
tablename = table
if self.all_cols:
table = table
else:
table = "%s (%s) " % (table, ", ".join(columnlist))
self.log.debug("COPY will use table definition: '%s'" % table)
if EOF or self.running_commands == self.copy_every \
and self.buffer is not None:
# time to copy data to PostgreSQL table
@ -432,6 +421,17 @@ ORDER BY attnum
self.log.warning("no data to COPY")
return False
##
# build the table colomns specs from parameters
# ie. we always issue COPY table (col1, col2, ..., coln) commands
tablename = table
if self.all_cols:
table = table
else:
table = "%s (%s) " % (table, ", ".join(columnlist))
self.log.debug("COPY will use table definition: '%s'" % table)
if CLIENT_MIN_MESSAGES <= logging.DEBUG:
self.save_copy_buffer(tablename, debug = True)