Skip to content

Commit

Permalink
Merge 1100dc6 into e0e648d
Browse files Browse the repository at this point in the history
  • Loading branch information
magnunleno committed Sep 26, 2017
2 parents e0e648d + 1100dc6 commit 2a2d37f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions postgres_copy/copy_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Handlers for working with PostgreSQL's COPY TO command.
"""
from __future__ import unicode_literals
from django.db import connection
from django.db import connections
from psycopg2.extensions import adapt
from django.db.models.sql.query import Query
from django.db.models.sql.compiler import SQLCompiler
Expand Down Expand Up @@ -44,7 +44,7 @@ def execute_sql(self, csv_path):
# open file for writing
# use stdout to avoid file permission issues
with open(csv_path, 'wb') as stdout:
with connection.cursor() as c:
with connections[self.using].cursor() as c:
# compile the SELECT query
select_sql = self.as_sql()[0] % adapted_params
# then the COPY TO query
Expand Down

0 comments on commit 2a2d37f

Please sign in to comment.