You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "WillAyd (via GitHub)" <gi...@apache.org> on 2023/10/02 15:51:59 UTC

[I] python: Postgres .execute throws ValueError with trailing semicolon in statement [arrow-adbc]

WillAyd opened a new issue, #1147:
URL: https://github.com/apache/arrow-adbc/issues/1147

   Tested on 0.7.0
   
   ```python
   from adbc_driver_postgresql import dbapi as pg_dbapi
   from adbc_driver_sqlite import dbapi as sqlite_dbapi
   
   
   sqlite_uri = "file::memory"
   with sqlite_dbapi.connect(sqlite_uri) as conn:
       with conn.cursor() as cur:
           cur.execute("SELECT current_date;")  # executes without error
       
   pg_uri = "postgresql://postgres:postgres@localhost:5432/pandas"
   with pg_dbapi.connect(pg_uri) as conn:
       with conn.cursor() as cur:
           cur.execute("SELECT current_date;")        
   ```
   
   The postgres execute call yields
   
   ```sh
   ProgrammingError                          Traceback (most recent call last)
   Cell In[3], line 13
        11 with pg_dbapi.connect(pg_uri) as conn:
        12     with conn.cursor() as cur:
   ---> 13         cur.execute("SELECT current_date;")        
   
   File ~/mambaforge/envs/pandas-dev/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py:669, in Cursor.execute(self, operation, parameters)
       654 """
       655 Execute a query.
       656 
      (...)
       666     parameters, which will each be bound in turn).
       667 """
       668 self._prepare_execute(operation, parameters)
   --> 669 handle, self._rowcount = self._stmt.execute_query()
       670 self._results = _RowIterator(
       671     # pyarrow.RecordBatchReader._import_from_c(handle.address)
       672     _reader.AdbcRecordBatchReader._import_from_c(handle.address)
       673 )
   
   File ~/mambaforge/envs/pandas-dev/lib/python3.10/site-packages/adbc_driver_manager/_lib.pyx:1106, in adbc_driver_manager._lib.AdbcStatement.execute_query()
   
   File ~/mambaforge/envs/pandas-dev/lib/python3.10/site-packages/adbc_driver_manager/_lib.pyx:227, in adbc_driver_manager._lib.check_error()
   
   ProgrammingError: INVALID_ARGUMENT: [libpq] Failed to execute query: could not begin COPY: ERROR:  syntax error at or near ";"
   LINE 1: COPY (SELECT current_date;) TO STDOUT (FORMAT binary)
                                    ^
   
   Query was: COPY (SELECT current_date;) TO STDOUT (FORMAT binary). SQLSTATE: 42601
   ```


-- 
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


Re: [I] c/driver/postgresql: handle trailing semicolon in statement when creating COPY statement [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #1147: c/driver/postgresql: handle trailing semicolon in statement when creating COPY statement
URL: https://github.com/apache/arrow-adbc/issues/1147


-- 
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


Re: [I] c/driver/postgresql: handle trailing semicolon in statement when creating COPY statement [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1147:
URL: https://github.com/apache/arrow-adbc/issues/1147#issuecomment-1743279561

   CC @ywc88 


-- 
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