Skip to contents

db_get_range() never lets arrow guess a column type. This function reports the type it will assign to each field, which is useful when you want to pass your own col_types or to check the package against db_list_fields().

Usage

db_field_types(fields, schema = NULL)

Arguments

fields

Character vector of field names, for instance the name column of db_list_fields().

schema

Optional schema name. One field is schema-dependent: action is a character code in the book and trade schemas and a numeric enum in status.

Value

A tibble with name and kind, where kind is one of "timestamp", "price", "character", "int64" or "int32".

Examples

db_field_types(c("ts_event", "open", "action", "order_id", "flags"))
#> # A tibble: 5 × 2
#>   name     kind     
#>   <chr>    <chr>    
#> 1 ts_event timestamp
#> 2 open     price    
#> 3 action   character
#> 4 order_id int64    
#> 5 flags    int32    
db_field_types("action", schema = "status")
#> # A tibble: 1 × 2
#>   name   kind 
#>   <chr>  <chr>
#> 1 action int32