Skip to contents

{kwt} provides functions to help query the database quickly and easily. To use these functions, you need to have an ODBC connection set up. If you haven’t done this yet, follow the instructions in the Connect to a PostgreSQL Database using ODBC article.

1 - Create a connection object

The first step is to create a connection object. This is done using the db_connect() function. This function takes the name of the ODBC connection you set up in the previous step.

#db <- db_connect("shared")

2 - Get a table or view

You can query a table or view using the db_query_table() function. This function takes the connection object and the name of the table you want to query.