dssg / dssg/ohio

pandas extension `pg_copy_from` silently converts `text` objects to `str`

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
19
Forks
0
PR merge metrics
No merged PRs in 30d

Description

As a user, I expect, because I am also passing a sqlalchemy connectable, that `pg_copy_from` would respect the properties of a `text` object passed as the query (including using the default values of any bound parameters at execution), but it silently [converts the `text` object to a plain `str`](https://github.com/dssg/ohio/blob/7bc56f7f605a2b86d4a9f93a76a2c9e6f7de6393/src/ohio/ext/pandas.py#L166).

A couple of solutions are possible:
1. Document that the copy extensions convert things to string (and maybe give a warning when getting something other than a string)
2. Support text objects in a way compatible with user expectations of sqlalchemy

2 seems nicer but :shrug:

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.