Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports: dbplyr v2.3.1 #2

Open
TuQmano opened this issue Apr 24, 2023 · 0 comments
Open

Imports: dbplyr v2.3.1 #2

TuQmano opened this issue Apr 24, 2023 · 0 comments

Comments

@TuQmano
Copy link
Member

TuQmano commented Apr 24, 2023

Este flujo permite vincular todas las tablas (desde PROV hasta PERSONA) a partir de indices para generar consultas a nivel más desagregado. Si la versión de dbplyr es menor a 2.3.1 (la generación de queries SQL produce errores en una cadena larga al referencia las tablas).

Refernecia de issue tidyverse/dbplyr#1101

tbl(censo_conectar(), "PROV") %>%
+    inner_join(tbl(censo_conectar(), "DPTO"), by = "PROV_REF_ID" ) %>%
+    inner_join(tbl(censo_conectar(), "FRAC"), by = "DPTO_REF_ID" )%>%
+    inner_join(tbl(censo_conectar(), "RADIO"), by = "FRAC_REF_ID" )%>%
+    inner_join(tbl(censo_conectar(), "VIVIENDA"), by = "RADIO_REF_ID" ) %>%
+    inner_join(tbl(censo_conectar(), "HOGAR"), by = "VIVIENDA_REF_ID" )%>%
+    inner_join(tbl(censo_conectar(), "PERSONA"), by = "HOGAR_REF_ID" )

Actualizando a versión 2.3.1 la consulta resulta exitosa:


# Source:   SQL [?? x 61]
# Database: DuckDB 0.6.2-dev1166 [jruiznicolini@Windows 10 x64:R 4.1.2/C:/Users/jruiznicolini/AppData/Roaming/R/data/R/censAr/censAr_duckdb_v062.sql]
   PROV_R~1 CPV20~2 IDPROV PROV  NOMPROV DPTO_~3 IDDPTO DPTO  NOMDPTO FRAC_~4 IDFRAC RADIO~5 IDRADIO VIVIE~6 TIPVV   V01
      <int>   <int>  <int> <chr> <chr>     <int> <chr>  <chr> <chr>     <int> <chr>    <int> <chr>     <int> <int> <int>
 1        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364909     1     4
 2        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364910     1     1
 3        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364910     1     1
 4        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364910     1     1
 5        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364910     1     1
 6        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364910     1     1
 7        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364913     1     1
 8        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364913     1     1
 9        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364913     1     1
10        1       1      2 2     Ciudad~       4 004    2004  Comuna~      88 07         857 06       364913     1     1
# ... with more rows, 45 more variables: V02 <int>, V00 <int>, URP <int>, INCALSERV <int>, INMAT <int>, MUNI <int>,
#   local <int>, INCALCONS <int>, TOTHOG <dbl>, HOGAR_REF_ID <int>, NHOG <int>, H05 <int>, H06 <int>, H07 <int>,
#   H08 <int>, H09 <int>, H10 <int>, H11 <int>, H12 <int>, H13 <int>, H14 <int>, H15 <int>, H16 <int>, H19A <int>,
#   H19B <int>, H19C <int>, H19D <int>, PROP <int>, INDHAC <int>, TOTPERS <int>, ALGUNBI <int>, PERSONA_REF_ID <int>,
#   personan <int>, P01 <int>, P02 <int>, P03 <int>, P05 <int>, P07 <int>, P12 <int>, EDADAGRU <int>, EDADQUI <int>,
#   P08 <int>, P09 <int>, P10 <int>, CONDACT <int>, and abbreviated variable names 1: PROV_REF_ID, 2: CPV2010_REF_ID,
#   3: DPTO_REF_ID, 4: FRAC_REF_ID, 5: RADIO_REF_ID, 6: VIVIENDA_REF_ID
# i Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
@TuQmano TuQmano changed the title Imports: dplyr v2.3.1 Imports: dbplyr v2.3.1 Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant