sql_subset: sql_subset

Description Usage Arguments Author(s) Examples

View source: R/sql_subset.r

Description

Constructs an SQL query for a postgres database. Modelled on the base R function 'subset'.

Usage

1
sql_subset(conn, x, subset, select, schema, limit, eval)

Arguments

conn

database connection

x

the table name

subset

the SQL 'where' statement

select

which variables to include

schema

the schema that has the table in it

limit

limit, often useful for debugging

eval

evaluate the query on the database?

Author(s)

ivanhanigan

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
ch <- connect2postgres('115.146.84.135', db='ewedb',
                       user='gislibrary', p='gislibrary')
sql <- sql_subset(conn=ch, x='spatial_ref_sys',
                  subset = "srid = 4283", select='srid, srtext',
                  limit = 2, eval = T)
  

## End(Not run)  

swish-climate-impact-assessment/swishdbtools documentation built on May 21, 2020, 1:03 a.m.