https://github.com/dasfmi/nosferatu
Access your postgres db as python objects
https://github.com/dasfmi/nosferatu
objects oop postgres python
Last synced: about 1 year ago
JSON representation
Access your postgres db as python objects
- Host: GitHub
- URL: https://github.com/dasfmi/nosferatu
- Owner: dasfmi
- Created: 2017-10-09T03:02:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-18T01:08:41.000Z (over 8 years ago)
- Last Synced: 2025-02-14T05:19:51.977Z (over 1 year ago)
- Topics: objects, oop, postgres, python
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nosferatu
(this project is for learning purposes and still under heavy development and breaking changes)
Access your postgres db,tables,columns as objects
e.g:
```python
from nosferatu import Nosferatu
con = {'host': localhost, 'database': 'your_db_name'}
db = Nosferatu.connect(con)
# print list of tables that exists in the db
for t in db.tables:
print(t)
# assuming there is a table called posts
db.posts.inspect() # retrieves list of columns
# id
# title
# body
# created_at
# retreive list of posts
posts = db.posts.filter("title LIKE '%hello%'").all()
for p in posts:
print(p.title, p.created_at)
```