Coder Social home page Coder Social logo

buenavista's Introduction

Buena Vista: A Programmable Postgres Proxy Server

Buena Vista is a Python library that provides a socketserver-based implementation of the Postgres wire protocol (PDF).

I started working on this project in order to address a common issue that people had when they were using another one of my Python projects, dbt-duckdb: when a long-running Python process is operating on a DuckDB database, you cannot connect to the DuckDB file using the CLI or with a database query tool like DBeaver to examine the state of the database, because each DuckDB file may only be open by a single process at a time. Using Buena Vista, we can start a thread in a long-running Python process like dbt-duckdb so that we can run queries against the data from DuckDB while the process is running, without having to wait until it has finished. I've implemented a prototype of this idea within the Buena Vista library at examples/duckdb_server.py, and you can run it like so:

git clone https://github.com/jwills/buenavista.git
cd buenavista
PYTHONPATH=. python3 examples/duckdb_server.py [duckdb.dbfile]

in order to start a Postgres server on localhost:5433 backed by the DuckDB database file that you passed in at the command line (or by an in-memory DuckDB database if you do not specify an argument.) You should be able to query the database via psql in another window by running psql -h localhost -p 5433 (no database/username/password arguments required) or by using the DBeaver Postgres client connection. (Note: there is still some work to do around transaction handling and making the full DuckDB table/view catalog accessible to DBeaver, but most queries should run successfully.)

buenavista's People

Contributors

mause avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.