You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "mcrumiller (via GitHub)" <gi...@apache.org> on 2024/08/21 14:24:40 UTC
[I] Support `SHOW` command [arrow-adbc]
mcrumiller opened a new issue, #2093:
URL: https://github.com/apache/arrow-adbc/issues/2093
### What feature or improvement would you like to see?
In postgres, the [`show`](https://www.postgresql.org/docs/current/sql-show.html) command returns server/session configuration attributes:
```sql
SHOW all
```

The `show` command doesn't appear to be recognized by abdc:
```pycon
>>> cur.execute("show all")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Projects\cqn-bur\.venv_cqn\Lib\site-packages\adbc_driver_manager\dbapi.py", line 698, in execute
handle, self._rowcount = _blocking_call(
^^^^^^^^^^^^^^^
File "adbc_driver_manager\\_lib.pyx", line 1590, in adbc_driver_manager._lib._blocking_call
File "adbc_driver_manager\\_lib.pyx", line 1213, in adbc_driver_manager._lib.AdbcStatement.execute_query
File "adbc_driver_manager\\_lib.pyx", line 260, in adbc_driver_manager._lib.check_error
adbc_driver_manager.ProgrammingError: INVALID_ARGUMENT: [libpq] Failed to execute query: could not begin COPY: ERROR: syntax error at or near "show"
LINE 1: COPY (show all) TO STDOUT (FORMAT binary)
```
--
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] Support `SHOW` command [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #2093: Support `SHOW` command
URL: https://github.com/apache/arrow-adbc/issues/2093
--
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] Support `SHOW` command [arrow-adbc]
Posted by "mcrumiller (via GitHub)" <gi...@apache.org>.
mcrumiller commented on issue #2093:
URL: https://github.com/apache/arrow-adbc/issues/2093#issuecomment-2302255419
Thank you!
--
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
Re: [I] Support `SHOW` command [arrow-adbc]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #2093:
URL: https://github.com/apache/arrow-adbc/issues/2093#issuecomment-2302242172
Thank you for reporting!
In the forthcoming release we'll have a workaround for queries not supported by COPY, although we probably need to do some work to integrate the option into dbapi. The workaround in the current development version might look like:
```python
import adbc_driver_postgresql.dbapi
con = adbc_driver_postgresql.dbapi.connect(
uri="postgresql://localhost:5432/postgres?user=postgres&password=password"
)
with con.cursor() as cur:
cur.adbc_statement.set_options(**{"adbc.postgresql.use_copy": "false"})
cur.execute("show all")
df = cur.fetch_df()
df
```
<img width="607" alt="Screenshot 2024-08-21 at 11 49 35 AM" src="https://github.com/user-attachments/assets/5fb5d265-0ba0-4a8e-a6bb-26bf095dddd2">
In R the workaround would look like:
``` r
library(adbcdrivermanager)
con <- adbc_database_init(
adbcpostgresql::adbcpostgresql(),
uri = "postgresql://localhost:5432/postgres?user=postgres&password=password"
) |>
adbc_connection_init()
out <- nanoarrow::nanoarrow_allocate_array_stream()
con |>
adbc_statement_init(
"adbc.postgresql.use_copy" = "false"
) |>
adbc_statement_set_sql_query("SHOW ALL") |>
adbc_statement_execute_query(out)
#> [1] -1
tibble::as_tibble(out)
#> # A tibble: 362 × 3
#> name setting description
#> <chr> <chr> <chr>
#> 1 allow_in_place_tablespaces "off" Allows tablespaces directly inside p…
#> 2 allow_system_table_mods "off" Allows modifications of the structur…
#> 3 application_name "" Sets the application name to be repo…
#> 4 archive_cleanup_command "" Sets the shell command that will be …
#> 5 archive_command "(disabled)" Sets the shell command that will be …
#> 6 archive_library "" Sets the library that will be called…
#> 7 archive_mode "off" Allows archiving of WAL files using …
#> 8 archive_timeout "0" Sets the amount of time to wait befo…
#> 9 array_nulls "on" Enable input of NULL elements in arr…
#> 10 authentication_timeout "1min" Sets the maximum allowed time to com…
#> # ℹ 352 more rows
```
<sup>Created on 2024-08-21 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>
--
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
Re: [I] Support `SHOW` command [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #2093:
URL: https://github.com/apache/arrow-adbc/issues/2093#issuecomment-2709429417
https://github.com/apache/arrow-adbc/pull/2589 includes an example for this.
--
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