Skip to content

Instantly share code, notes, and snippets.

@exy02
Last active October 10, 2020 20:26
Show Gist options
  • Save exy02/f907401b46f2d9790b118837010cb829 to your computer and use it in GitHub Desktop.
Save exy02/f907401b46f2d9790b118837010cb829 to your computer and use it in GitHub Desktop.
Simplified PostgreSQL querying (with or without SSH) - General Queries
sql_statement = """
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'ey_test_table'
;
"""
query_df = pgres.query(db='database_name', query=sql_statement)
query_df
#returns the results of an sql statement as a pandas dataframe.
#This example returns the column names and data types of table 'ey_test_table'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment