Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix COPY that uses globals over SQL adapter #7860

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/test_sql_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,37 @@ async def test_sql_query_copy_04(self):
),
)

async def test_sql_query_copy_05(self):
# copy of table with columns specified

tran = self.scon.transaction()
await tran.start()

await self.scon.execute(
'SET LOCAL "global default::username_prefix" TO user_;'
)

out = io.BytesIO()
await self.scon.copy_from_table(
"Person",
columns=['first_name', 'username'],
output=out,
format="csv",
delimiter="\t",
)
out = io.StringIO(out.getvalue().decode("utf-8"))
res = list(csv.reader(out, delimiter="\t"))
self.assert_data_shape(
res,
tb.bag(
[
["Robin", "user_robin"],
["Steven", "user_steven"],
["Tom", "user_tom"],
]
),
)

async def test_sql_query_error_01(self):
with self.assertRaisesRegex(
asyncpg.InvalidTextRepresentationError,
Expand Down
Loading