Skip to content

Commit

Permalink
update PG (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
haobibo authored May 26, 2024
1 parent 5d46522 commit b809f92
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Aloha!

[![License](https://img.shields.io/github/license/QPod/aloha)](https://github.com/QPod/aloha/blob/main/LICENSE)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/QPod/aloha/build)](https://github.com/QPod/aloha/actions)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/QPod/aloha-python/pip.yml?branch=main)](https://github.com/QPod/aloha-python/actions)
[![Join the Gitter Chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/QPod/)
[![PyPI version](https://img.shields.io/pypi/v/aloha)](https://pypi.python.org/pypi/aloha/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/aloha)](https://pepy.tech/badge/aloha/)
Expand All @@ -21,6 +21,6 @@ Please generously STAR★ our project or donate to us! [![GitHub Starts](https:

## Getting started

```py
```shell
pip install aloha[all]
```
8 changes: 4 additions & 4 deletions src/aloha/db/postgres.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
__all__ = ('PostgresOperator',)

import psycopg2
import psycopg
from sqlalchemy import create_engine
from sqlalchemy.sql import text

from .base import PasswordVault
from ..logger import LOG

LOG.debug('postgres: psycopg2 version = %s' % psycopg2.__version__)
LOG.debug('postgres: psycopg2 version = %s' % psycopg.__version__)


class PostgresOperator:
Expand All @@ -26,8 +26,8 @@ def __init__(self, db_config, **kwargs):

try:
self.engine = create_engine(
'postgresql+psycopg2://{user}:{password}@{host}:{port}/{dbname}'.format(**self._config),
connect_args=connect_args, client_encoding='utf8', encoding='utf-8',
'postgresql+psycopg://{user}:{password}@{host}:{port}/{dbname}'.format(**self._config),
connect_args=connect_args, client_encoding='utf8',
pool_size=20, max_overflow=10, pool_pre_ping=True, **kwargs
)
LOG.debug("PostgresSQL connected: {host}:{port}/{dbname}".format(**self._config))
Expand Down
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
dict_extra_requires = {
'build': ['Cython'],
'service': ['requests', 'tornado', 'psutil', 'pyjwt'],
'db': ['sqlalchemy<2', 'psycopg2-binary', 'pymysql', 'elasticsearch', 'pymongo', 'redis>4.2.0'],
'db': ['sqlalchemy', 'psycopg[binary]', 'pymysql', 'elasticsearch', 'pymongo', 'redis'],
'stream': ['confluent_kafka'],
'data': ['pandas'],
'report': ['openpyxl>=3', 'XlsxWriter'],
Expand Down

0 comments on commit b809f92

Please sign in to comment.