Git Product home page Git Product logo

Comments (7)

elysabethpc avatar elysabethpc commented on September 21, 2024 3

I got postgres_scanner build and run in Windows with rtools 4.3 doing this:

set PATH=C:\rtools43\x86_64-w64-mingw32.static.posix\bin;C:\rtools43\usr\bin;%PATH%
git clone https://github.com/duckdb/postgres_scanner.git
cd postgres_scanner\
git submodule init
git pull --recurse-submodules
cd duckdb
git checkout tags/v0.10.0
cd ..
git checkout 2eb532b17cdef1b
git apply ..\postgres_scanner_0.10.0_rtools_4.3.patch

# this will fail
make

patch -p1 < ..\win32_port.patch 

# this should be ok
make

strip build/release/extension/postgres_scanner/postgres_scanner.duckdb_extension
mkdir C:\Users\user\AppData\Roaming\R\data\R\duckdb\extensions\v0.10.0\windows_amd64_rtools
cp build\release\extension\postgres_scanner\postgres_scanner.duckdb_extension C:\Users\user\AppData\Roaming\R\data\R\duckdb\extensions\v0.10.0\windows_amd64_rtools

in postgres

# in WSL postgres server
sudo -u postgres psql
postgres=# create database basedatos owner dev;
\q
psql -U dev -d basedatos
basedatos=> create table tabla(col1 int, col2 text, col3 timestamp with time zone);
basedatos=> insert into tabla values(5,'prueba', '2024-03-17 09:50:50' AT TIME ZONE 'Europe/Madrid');
\q

Test

"c:\Program Files\R\R-4.3.3\bin\Rscript.exe" ..\postgres_scanner_test.R

in R:

library(DBI)
library(duckdb)
library(tidyverse)

con <- dbConnect(duckdb::duckdb(config=list('allow_unsigned_extensions'='true')))

dbExecute(con,"load postgres_scanner;")
dbGetQuery(con,"from duckdb_extensions();") |> tibble() |>
  filter(loaded==TRUE)

dbGetQuery(con,"select * from postgres_scan('dbname=basedatos user=dev password=password host=127.0.0.1', 'public', 'tabla');") |> glimpse()
dbExecute(con,"create schema abc;")
dbExecute(con,"CALL postgres_attach('dbname=basedatos user=dev password=password host=127.0.0.1', source_schema='public', sink_schema='abc');")

tbl(con,sql("SELECT * from information_schema.tables"))
tbl(con,"abc.tabla")


dbExecute(con,"install icu;")
dbExecute(con,"install json;")
dbExecute(con,"install fts;")
dbExecute(con,"install httpfs;")
dbExecute(con,"install spatial;")
dbExecute(con,"load icu;")
dbExecute(con,"load json;")
dbExecute(con,"load fts;")
dbExecute(con,"load httpfs;")
dbExecute(con,"load spatial;")


dbGetQuery(con,"from duckdb_extensions();") |> tibble() |>
  filter(loaded==TRUE)
  
# tz lost
tbl(con,"abc.tabla") |> pull(col3)

tbl(con,"abc.tabla") |>
  collect() |> 
  mutate(col3=with_tz(col3,"Europe/Madrid")) |> 
  pull(col3)

postgres_scanner_0.10.0_rtools_4.3.patch
postgres_scanner_test.txt
win32_port.patch

from duckdb-r.

arthurgailes avatar arthurgailes commented on September 21, 2024 1

Is this still an issue?

Yes.

from duckdb-r.

Tmonster avatar Tmonster commented on September 21, 2024

Hi elysabethpc,

There are currently some known issues with installing extensions on windows. We're working on it!
I think duckdb/duckdb#8243 is probably related as well

from duckdb-r.

krlmlr avatar krlmlr commented on September 21, 2024

Is this still an issue?

from duckdb-r.

dpprdan avatar dpprdan commented on September 21, 2024

The spatial extension is installable with the latest dev version (r-universe), postgres not yet.

library(duckdb)
#> Loading required package: DBI

ddb_con <- dbConnect(duckdb())

dbExecute(ddb_con, "INSTALL spatial; LOAD spatial;")
#> [1] 0
dbExecute(ddb_con, "INSTALL postgres; LOAD postgres;")
#> Error: rapi_prepare: Failed to execute statement INSTALL postgres; LOAD postgres;
#> Error: HTTP Error: Failed to download extension "postgres_scanner" at URL "http://extensions.duckdb.org/v0.10.0/windows_amd64_rtools/postgres_scanner.duckdb_extension.gz"
#> Extension "postgres_scanner" is an existing extension.

dbDisconnect(ddb_con)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.3.3 (2024-02-29 ucrt)
#>  os       Windows 11 x64 (build 22631)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language en
#>  collate  German_Germany.utf8
#>  ctype    German_Germany.utf8
#>  tz       Europe/Berlin
#>  date     2024-03-08
#>  pandoc   3.1.12.2 @ C:/PROGRA~1/Pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version     date (UTC) lib source
#>  cli           3.6.2       2023-12-11 [1] CRAN (R 4.3.2)
#>  DBI         * 1.2.2       2024-02-16 [1] CRAN (R 4.3.2)
#>  digest        0.6.34      2024-01-11 [1] CRAN (R 4.3.2)
#>  duckdb      * 0.9.99.9000 2024-03-07 [1] https://duckdb.r-universe.dev (R 4.3.3)
#>  evaluate      0.23        2023-11-01 [1] CRAN (R 4.3.2)
#>  fastmap       1.1.1       2023-02-24 [1] CRAN (R 4.3.0)
#>  fs            1.6.3       2023-07-20 [1] CRAN (R 4.3.1)
#>  glue          1.7.0       2024-01-09 [1] CRAN (R 4.3.2)
#>  htmltools     0.5.7       2023-11-03 [1] CRAN (R 4.3.2)
#>  knitr         1.45        2023-10-30 [1] CRAN (R 4.3.1)
#>  lifecycle     1.0.4       2023-11-07 [1] CRAN (R 4.3.2)
#>  magrittr      2.0.3       2022-03-30 [1] CRAN (R 4.3.0)
#>  purrr         1.0.2       2023-08-10 [1] CRAN (R 4.3.1)
#>  R.cache       0.16.0      2022-07-21 [1] CRAN (R 4.3.0)
#>  R.methodsS3   1.8.2       2022-06-13 [1] CRAN (R 4.3.0)
#>  R.oo          1.26.0      2024-01-24 [1] CRAN (R 4.3.2)
#>  R.utils       2.12.3      2023-11-18 [1] CRAN (R 4.3.2)
#>  reprex        2.1.0       2024-01-11 [1] CRAN (R 4.3.2)
#>  rlang         1.1.3       2024-01-10 [1] CRAN (R 4.3.2)
#>  rmarkdown     2.26        2024-03-05 [1] CRAN (R 4.3.3)
#>  rstudioapi    0.15.0      2023-07-07 [1] CRAN (R 4.3.1)
#>  sessioninfo   1.2.2       2021-12-06 [1] CRAN (R 4.3.0)
#>  styler        1.10.2      2023-08-29 [1] CRAN (R 4.3.1)
#>  vctrs         0.6.5       2023-12-01 [1] CRAN (R 4.3.2)
#>  withr         3.0.0       2024-01-16 [1] CRAN (R 4.3.2)
#>  xfun          0.42        2024-02-08 [1] CRAN (R 4.3.2)
#>  yaml          2.3.8       2023-12-11 [1] CRAN (R 4.3.2)
#> 
#>  [1] C:/Users/Daniel.AK-HAMBURG/AppData/Local/R/win-library/4.3
#>  [2] C:/Program Files/R/R-4.3.3/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Apparently the extensions have to be built with the msys2/mingw flavor that R uses.

from duckdb-r.

krlmlr avatar krlmlr commented on September 21, 2024

Thanks! I filed an issue upstream.

from duckdb-r.

clickleasedbarney avatar clickleasedbarney commented on September 21, 2024

elysabethpc:

by chance do you have an update to the 3/17/24 comment above? i really need to get postgres_scanner working with duckdb in R but am using all the latest versions of duckdb and R, and cannot see how to get the patches to work...if you can guide or have examples of how to update thru the versions it would be much appreciated. Thanks.

from duckdb-r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.