A simple and light DB package
Project description
# instadb 🔌
A simple and light DB python package
## Features
- query from postgres and reshift
- load data into pandas dataframe
- query from sql or filename
- automatically setup connections from env variables
- automatic query annotation
- connect timeout retry with exponential backoff
### Installation
`pip install instadb`
### Basic Usage
```python
import instadb
db = instadb.Connection(url=database_url)
df = db.dataframe("select * from users limit 10")
```
If you have env variables that match the pattern `<key>_DATABASE_URL` then you can directly do:
```python
import instadb
df = instadb.key.dataframe("select * from users limit 10")
```
### Query from file
```python
df = instadb.key.dataframe(filename='./users.sql')
```
### Query from file with arguments
users.sql
```
select * from users where limit={limit}
```
```python
df = instadb.key.dataframe(filename='./users.sql', limit=100)
```
## TODO
- [ ] load data to list
- [ ] insert and update queries
- [ ] caching
A simple and light DB python package
## Features
- query from postgres and reshift
- load data into pandas dataframe
- query from sql or filename
- automatically setup connections from env variables
- automatic query annotation
- connect timeout retry with exponential backoff
### Installation
`pip install instadb`
### Basic Usage
```python
import instadb
db = instadb.Connection(url=database_url)
df = db.dataframe("select * from users limit 10")
```
If you have env variables that match the pattern `<key>_DATABASE_URL` then you can directly do:
```python
import instadb
df = instadb.key.dataframe("select * from users limit 10")
```
### Query from file
```python
df = instadb.key.dataframe(filename='./users.sql')
```
### Query from file with arguments
users.sql
```
select * from users where limit={limit}
```
```python
df = instadb.key.dataframe(filename='./users.sql', limit=100)
```
## TODO
- [ ] load data to list
- [ ] insert and update queries
- [ ] caching
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
instadb-0.4.2.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file instadb-0.4.2.tar.gz
.
File metadata
- Download URL: instadb-0.4.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2c60820af7480087343919fbe118d4b33acfb2ce8df8d25f96898e0e655cd8c |
|
MD5 | 5f3ebb48c4e5a5bdc1d9e845b807c7f3 |
|
BLAKE2b-256 | 58116db163187cd89e1842072082b5cf82cee840b9a854987c7a27db4829ffb2 |
File details
Details for the file instadb-0.4.2-py2.py3-none-any.whl
.
File metadata
- Download URL: instadb-0.4.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16659060b9d8bc93592a12aefb59775e21cc2a1a83c769c5c0dec36aae74381c |
|
MD5 | 3cb06ca4e31b7fd1e4ebe8d4d21f696a |
|
BLAKE2b-256 | 12ecfa0e21610e6892cfd120223645226eac5c8c642994c622d8add4017d2427 |