Now have been in a position to get started querying! The outlined magnificence handiest supplies a handful of fundamental purposes. Let’s stroll thru how to use the category and what we will be able to do with it.

First, we’ll want to specify our PostgreSQL connection arguments, and SSH arguments (if SSH tunneling is needed to get entry to the far off server).

We outline pgres as our connection to simplify each and every time we wish to question the database or discover the organizational construction of the database. You can be precipitated in your PostgreSQL username and password, which might be saved as transient variables (best-practice is to save those variables as surroundings variables as an alternative).

Next, we will be able to discover the schemas of our given database named ‘database_name’ to to find our schema of pastime using the .schemas() serve as.

If we wish to discover the schema named ‘schema_name’, we will be able to go back the names of the tables inside the schema using the .tables() serve as.

Finally, we will be able to use .question() to run same old SQL queries (for PostgreSQL). In this situation we’re querying the column names and information sorts from the desk named ‘ey_test_table

Try changing the contents of sql_statement with your individual question, and feature amusing!

LEAVE A REPLY

Please enter your comment!
Please enter your name here