You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "judahrand (via GitHub)" <gi...@apache.org> on 2023/09/07 16:33:33 UTC
[GitHub] [arrow-adbc] judahrand opened a new issue, #1045: c/driver/postgresql: cannot infer schema for `CREATE TABLE`
judahrand opened a new issue, #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045
`CREATE TABLE` statements do not work with he current schema inference and so fail.
```bash
❯ python -c 'import adbc_driver_postgresql; print(adbc_driver_postgresql.__version__)'
0.6.0
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm closed issue #1045: python/adbc_driver_postgresql: return more useful error messages
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #1045: python/adbc_driver_postgresql: return more useful error messages
URL: https://github.com/apache/arrow-adbc/issues/1045
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] judahrand commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "judahrand (via GitHub)" <gi...@apache.org>.
judahrand commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710470850
> Can you share the full query?
```python
cursor.execute('CREATE TEMPORARY TABLE "fa673c6fae1b49c88c5741c569c444d8" AS ("foo" BIGINT);')
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] judahrand commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "judahrand (via GitHub)" <gi...@apache.org>.
judahrand commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710477666
Whoops! That is my mistake! Porting SQL between dialects 🤦
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] judahrand commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "judahrand (via GitHub)" <gi...@apache.org>.
judahrand commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710484703
> Ah, no worries. But yes, to be fair, we could pass through the underlying error more clearly here.
Yes, and that might even help the next error I run into 🤣
```python
with conn.cursor() as cursor:
cursor.execute(f'CREATE TEMPORARY TABLE {temp_table} ( {input_columns} );')
if inp_table.num_rows > 0:
cursor.adbc_ingest(
temp_table,
inp_table,
mode='append',
)
```
results in
```
File "adbc_driver_manager/_lib.pyx", line 1068, in adbc_driver_manager._lib.AdbcStatement.execute_update
File "adbc_driver_manager/_lib.pyx", line 399, in adbc_driver_manager._lib.check_error
adbc_driver_manager.OperationalError: IO: [libpq] Failed to execute prepared statement:
```
which is equally difficult to debug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710475094
We could give a better error here, though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: return more useful error messages
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1715837250
Hmm, it appears this was already fixed somewhere in the work for ADBC 0.7.0 (the next release)
```
>>> import pyarrow
>>> import adbc_driver_postgresql.dbapi
>>> conn = adbc_driver_postgresql.dbapi.connect('postgres://postgres:password@localhost:5432/postgres')
>>> cur = conn.cursor()
>>> table = pyarrow.table([[1,2]], names=["a"])
>>> cur.execute('CREATE TEMPORARY TABLE foo (a BIGINT)')
>>> cur.adbc_ingest('foo', table, mode='append')
2
>>> cur.execute('SELECT * FROM foo')
>>> cur.fetch_arrow_table()
pyarrow.Table
a: int64
----
a: [[1,2]]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/adbc_driver_postgresql: return more useful error messages
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1715844688
#1054 still adds a unit test for this just in case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710487668
Indeed...
```python
>>> import pyarrow
>>> import adbc_driver_postgresql.dbapi
>>> conn = adbc_driver_postgresql.dbapi.connect('postgres://postgres:password@localhost:5432/postgres')
>>> cur = conn.cursor()
>>> import pyarrow
>>> table = pyarrow.table([[1,2]], names=["a"])
>>> cur.execute('CREATE TEMPORARY TABLE foo (a BIGINT)')
>>> cur.adbc_ingest('foo', table, mode='append')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lidavidm/venv/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 789, in adbc_ingest
return self._stmt.execute_update()
File "adbc_driver_manager/_lib.pyx", line 1068, in adbc_driver_manager._lib.AdbcStatement.execute_update
File "adbc_driver_manager/_lib.pyx", line 399, in adbc_driver_manager._lib.check_error
adbc_driver_manager.OperationalError: IO: [libpq] Failed to execute prepared statement:
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710482905
Ah, no worries. But yes, to be fair, we could pass through the underlying error more clearly here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710474911
```
>>> import adbc_driver_postgresql.dbapi
>>> conn = adbc_driver_postgresql.dbapi.connect('postgres://postgres:password@localhost:5432/postgres')
>>> cur = conn.cursor()
>>> cur.execute('CREATE TEMPORARY TABLE "fa673c6fae1b49c88c5741c569c444d8" AS ("foo" BIGINT);')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lidavidm/venv/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py", line 622, in execute
handle, self._rowcount = self._stmt.execute_query()
File "adbc_driver_manager/_lib.pyx", line 1009, in adbc_driver_manager._lib.AdbcStatement.execute_query
File "adbc_driver_manager/_lib.pyx", line 399, in adbc_driver_manager._lib.check_error
adbc_driver_manager.OperationalError: IO: [libpq] Failed to execute query: could not infer schema: failed to prepare query: ERROR: syntax error at or near ""foo""
LINE 1: ...RARY TABLE "fa673c6fae1b49c88c5741c569c444d8" AS ("foo" BIGI...
>>> conn.rollback()
>>> cur.execute('CREATE TEMPORARY TABLE "fa673c6fae1b49c88c5741c569c444d8" ("foo" BIGINT);')
>>>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710472694
Are you sure the `AS` needs to be there?
```sql
postgres=# CREATE TEMPORARY TABLE "fa673c6fae1b49c88c5741c569c444d8" AS ("foo" BIGINT);
ERROR: syntax error at or near ""foo""
LINE 1: ...RARY TABLE "fa673c6fae1b49c88c5741c569c444d8" AS ("foo" BIGI...
^
postgres=# CREATE TEMPORARY TABLE "fa673c6fae1b49c88c5741c569c444d8" ("foo" BIGINT);
CREATE TABLE
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710464726
Can you share the full query?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] judahrand commented on issue #1045: python/driver/postgresql: cannot infer schema for `CREATE TABLE`
Posted by "judahrand (via GitHub)" <gi...@apache.org>.
judahrand commented on issue #1045:
URL: https://github.com/apache/arrow-adbc/issues/1045#issuecomment-1710493413
This would probably be better as two separate issues:
1. Pass through more useful error message from Postgres
2. Can't `adbc_ingest` into temporary table
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org