Skip to contents

List the tables a module publishes

Usage

tg_tables(module = NULL, counts = FALSE)

tg_tabelas(modulo = NULL, contagens = FALSE)

Arguments

module

A module name from tg_modules(). Aliases such as "fundo_a_fundo" are accepted. NULL lists the tables of every module.

counts

If TRUE, adds a rows column with the number of rows each table currently holds. This is the only part of this function that needs a network connection: it makes one request per table, so tg_tables(counts = TRUE) with no module makes forty-eight. Responses are cached.

modulo

Portuguese alias for module, available in tg_tabelas() and tg_campos().

contagens

Portuguese alias for counts, available only in tg_tabelas().

Value

A tibble with one row per table: its module, name, number of columns, the primary key when the API declares one, and the description published in the API schema. With counts = TRUE, also the current number of rows.

See also

Examples

tg_tables("ted")
#> # A tibble: 13 × 5
#>    module table                      columns primary_key description
#>    <chr>  <chr>                        <int> <chr>       <chr>      
#>  1 ted    evento                          10 NA          NA         
#>  2 ted    nota_credito                    11 NA          NA         
#>  3 ted    plano_acao                      20 NA          NA         
#>  4 ted    plano_acao_analise               5 NA          NA         
#>  5 ted    plano_acao_etapa                10 NA          NA         
#>  6 ted    plano_acao_meta                 10 NA          NA         
#>  7 ted    plano_acao_parecer               7 NA          NA         
#>  8 ted    programa                        24 NA          NA         
#>  9 ted    programa_acao_orcamentaria       3 NA          NA         
#> 10 ted    programa_beneficiario            4 NA          NA         
#> 11 ted    programacao_financeira          10 NA          NA         
#> 12 ted    termo_execucao                  10 NA          NA         
#> 13 ted    trf                              6 NA          NA         
tg_tables()
#> # A tibble: 48 × 5
#>    module                  table                 columns primary_key description
#>    <chr>                   <chr>                   <int> <chr>       <chr>      
#>  1 transferenciasespeciais documento_habil_espe…      23 id_dh       NA         
#>  2 transferenciasespeciais empenho_especial           27 NA          NA         
#>  3 transferenciasespeciais executor_especial          17 NA          Informaçõe…
#>  4 transferenciasespeciais finalidade_especial         5 NA          NA         
#>  5 transferenciasespeciais historico_pagamento_…       5 id_histori… NA         
#>  6 transferenciasespeciais meta_especial              16 NA          NA         
#>  7 transferenciasespeciais ordem_pagamento_orde…      13 id_op_ob    NA         
#>  8 transferenciasespeciais orgao_analise_penden…       4 NA          NA         
#>  9 transferenciasespeciais plano_acao_especial        27 id_plano_a… NA         
#> 10 transferenciasespeciais plano_trabalho_anali…      10 NA          NA         
#> # ℹ 38 more rows

if (interactive()) {
  # How big is everything, largest first?
  tg_tables(counts = TRUE)[order(-tg_tables(counts = TRUE)$rows), ]
}