question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using https://github.com/psycopg/psycopg2 let’s add some tasks for working with a postgres database. The main function that we should add is execute which takes in an arbitrary SQL string to execute against a db.

On immediate appearance the ExecuteTask (or whatever it becomes called) should take in a db host, db name, user, pass, SQL string, data tuple, and optional commit param. http://initd.org/psycopg/docs/cursor.html?highlight=execute#cursor.execute

There are other functions such as fetchone, fetchmany, rowcount, etc… that may only be slightly useful and we should use this issue as a means to debate what we think is important. (http://initd.org/psycopg/docs/cursor.html)

cc @jlowin for your psycopg2 expertise

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zangell44commented, May 20, 2019

I’ll add in a separate task for fetch for now too and we can go from there

1reaction
joshmeekcommented, May 20, 2019

Good question, I think execute is the most useful in it’s ability to essentially allow any SQL command. If you see any others in psycopg2 which seem crucial for a Postgres aspect of someone’s workflow I welcome them but execute is a good first step!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 25. Routine Database Maintenance Tasks
PostgreSQL, like any database software, requires that certain tasks be performed regularly to achieve optimum performance. The tasks discussed here are ...
Read more >
Postgres Tasks - Prefect Docs
This module contains a collection of tasks for interacting with Postgres databases via the psycopg2 library. # PostgresExecute. class. prefect.tasks.postgres.
Read more >
PostgreSQL Exercises
The exercises on this site range from simple select and where clauses, through joins and case statements, and on to aggregations, window functions,...
Read more >
An Overview of Job Scheduling Tools for PostgreSQL
The tasks to perform can be any of the following ones: stored procedures; SQL statements; PostgreSQL commands (as VACUUM, or VACUUM ANALYZE).
Read more >
Common DBA tasks for Amazon RDS for PostgreSQL
Learn how to perform some common DBA tasks on DB instances running the Amazon RDS for PostgreSQL database engine.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found