-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# MongoDB integration | ||
|
||
To run Suppgram with MongoDB, you'll have to install optional dependencies: | ||
```shell | ||
python -m pip install "suppgram[mongodb]" | ||
``` | ||
|
||
Then you can configure the integration by database URI. Examples: | ||
|
||
```shell | ||
# All-in-one CLI + MongoDB (insecure) | ||
python -m suppgram.cli.all_in_one \ | ||
--mongodb-uri mongodb://user:password@host:27017/database \ | ||
... | ||
|
||
# All-in-one CLI + MongoDB (secret in environment variable) | ||
export MONGODB_URI=mongodb://user:password@host:27017/database | ||
python -m suppgram.cli.all_in_one ... | ||
|
||
# All-in-one CLI + MongoDB (secret in file) | ||
echo "mongodb://user:password@host:27017/database" > /secrets/mongodb_uri | ||
python -m suppgram.cli.all_in_one \ | ||
--mongodb-uri-file /secrets/mongodb_uri \ | ||
... | ||
``` | ||
|
||
Suppgram will create collections with names starting with `suppgram_`, so you may use | ||
a preexisting database instead of creating a separate one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# PostgreSQL/SQLite integration | ||
|
||
Suppgram ships with support for arbitrary persistent storage supported by SQLAlchemy, | ||
including PostgreSQL, SQLite and [numerous other databases](https://docs.sqlalchemy.org/en/20/dialects/). | ||
However, note that unit tests are only run for PostgreSQL (latest) and SQLite. | ||
|
||
To run Suppgram with SQLAlchemy, you'll have to install optional dependencies: | ||
```shell | ||
python -m pip install "suppgram[sqlalchemy]" | ||
``` | ||
This pack of dependencies includes asynchronous drivers for PostgreSQL and SQLite. | ||
For other databases, additional packages may be required. | ||
|
||
Then you can configure the integration the same way SQLAlchemy is normally configured — | ||
by database URI. Examples: | ||
```shell | ||
# All-in-one CLI + SQLite | ||
python -m suppgram.cli.all_in_one \ | ||
--sqlalchemy-uri sqlite+aiosqlite:///path/to/file.db \ | ||
... | ||
|
||
# All-in-one CLI + PostgreSQL (insecure) | ||
python -m suppgram.cli.all_in_one \ | ||
--sqlalchemy-uri postgresql+asyncpg://user:password@host:5432/database \ | ||
... | ||
|
||
# All-in-one CLI + PostgreSQL (secret in environment variable) | ||
export SQLALCHEMY_URI=postgresql+asyncpg://user:password@host:5432/database | ||
python -m suppgram.cli.all_in_one ... | ||
|
||
# All-in-one CLI + PostgreSQL (secret in file) | ||
echo "postgresql+asyncpg://user:password@host:5432/database" > /secrets/postgres_uri | ||
python -m suppgram.cli.all_in_one \ | ||
--sqlalchemy-uri-file /secrets/postgres_uri \ | ||
... | ||
``` | ||
|
||
Suppgram will create tables with names starting with `suppgram_`, so you may use | ||
a preexisting database instead of creating a separate one. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import sys | ||
|
||
print( | ||
"Error: 'suppgram' package is not directly runnable. Did you mean 'suppgram.cli.all_in_one'?", | ||
file=sys.stderr, | ||
) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters