Skip to content

'dbDataType' warning/message when using st_write on a database #2349

Closed
@andrew-plowright

Description

@andrew-plowright

In issue #1693, @etiennebr discusses two ways to connect to a database: gdal and sf "native". In his example, the second "native" solution generates the following warning/message:

#> Note: method with signature 'DBIObject#sf' chosen for function 'dbDataType',
#>  target signature 'PqConnection#sf'.
#>  "PqConnection#ANY" would also be valid

I am also getting a similar warning/message when appending data to a blank Geopackage.

# Create blank geopackage
blank_sf <- sf::st_sf(geometry  = sf::st_sfc(crs = sf::st_crs(4326)))
sf::st_write(blank_sf, "my_gpkg.gpkg")

# Connect to Geopackage
con <- DBI::dbConnect(RSQLite::SQLite(), dbname =  "my_gpkg.gpkg")

# Create new_data
data <- sf::st_sf(
  geom = sf::st_as_sfc(
    list(sf::st_polygon(list( cbind(c(0,1,1,0,0), c(0,0,1,1,0))))),
    crs = sf::st_crs(4326)
  )
)

# Append new data to Geopackage
sf::st_write(obj = data, dsn = con, driver = "GPKG", append = TRUE)
Note: method with signature ‘DBIObject#sf’ chosen for function ‘dbDataType’,
 target signature ‘SQLiteConnection#sf’.
 "SQLiteConnection#ANY" would also be valid

This message seems to only appear once. Repeating the operation doesn't generate it again unless the session is restarted. Is there any way to suppress this message?

My namespace:

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

loaded via a namespace (and not attached):
 [1] vctrs_0.6.3        cli_3.6.1          rlang_1.1.1        DBI_1.1.3          KernSmooth_2.23-21 generics_0.1.3     sf_1.0-14          glue_1.6.2         bit_4.0.5          e1071_1.7-13       fansi_1.0.4       
[12] grid_4.3.1         classInt_0.4-9     tibble_3.2.1       fastmap_1.1.1      lifecycle_1.0.3    memoise_2.0.1      compiler_4.3.1     dplyr_1.1.2        RSQLite_2.3.1      blob_1.2.4         Rcpp_1.0.12       
[23] pkgconfig_2.0.3    rstudioapi_0.15.0  R6_2.5.1           class_7.3-22       tidyselect_1.2.0   utf8_1.2.3         pillar_1.9.0       magrittr_2.0.3     tools_4.3.1        proxy_0.4-27       bit64_4.0.5       
[34] units_0.8-2        cachem_1.0.8  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions