dbstream

raw JSON →
0.1.28 verified Mon Apr 27 auth: no python

A meta package to connect to several databases with a unified streaming interface. Currently at version 0.1.28, with Python >=3 support. The project appears to be in early development with infrequent releases.

pip install dbstream
error ModuleNotFoundError: No module named 'dbstream'
cause Library not installed or installation incomplete.
fix
Run 'pip install dbstream' in your environment.
error ImportError: cannot import name 'DBStream' from 'dbstream'
cause Incorrect import path or very old version without the class.
fix
Use 'from dbstream import DBStream'. Ensure dbstream>=0.1.0 is installed.
error AttributeError: 'DBStream' object has no attribute 'stream'
cause The stream method was renamed or removed in a newer version (check changelog).
fix
Check the current API in documentation; possibly use 'exec' or 'query' instead.
breaking The library is very early stage (v0.1.x). API breaking changes are expected between minor versions. Pin to exact version in production.
fix Pin version: dbstream==0.1.28 in requirements.txt.
gotcha The DBStream object is an iterator. You must call .stream() before iterating, otherwise you get an empty result.
fix Always call .stream(query) first, then iterate over the object.
gotcha Connection strings must follow SQLAlchemy format. Unsupported databases will raise an ImportError at runtime.
fix Double-check your database URI. Example: 'postgresql://user:pass@host/db'.

Instantiate DBStream with a connection string and stream query results.

from dbstream import DBStream

db = DBStream('sqlite:///example.db')
db.stream('SELECT * FROM users')
for row in db:
    print(row)