Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scailer/py37 #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pg_store/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import psycopg2

from functools import wraps
from collections import namedtuple
from pulsar.apps.data import RemoteStore
from concurrent.futures import TimeoutError

Expand Down Expand Up @@ -54,7 +55,9 @@ def _init(self, **kwargs):
self._pool = aiopg.pool.Pool(
self.buildurl(), minsize=self.pool_size, maxsize=self.pool_size,
loop=self._loop, timeout=self.timeout, enable_json=True,
enable_hstore=True, enable_uuid=True, echo=False, on_connect=None)
enable_hstore=True, enable_uuid=True, echo=False, on_connect=None,
pool_recycle=-1
)

@property
def pool(self):
Expand Down Expand Up @@ -142,6 +145,14 @@ async def fetch_list(self, *args, **options):

return [{col.name: val for col, val in zip(desc, row)} for row in rows]

async def fetch_inst(self, *args, **options):
data = await self.fetch_object(*args, **options)
return namedtuple('Obj', data.keys())(**data)

async def fetch_inst_list(self, *args, **options):
data = await self.fetch_list(*args, **options)
return [namedtuple('Obj', item.keys())(**item) for item in data]

def safe_fetch_list(self, *args, **options):
return safe(self.fetch_list, *args, **options)

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

setup(
name='pulsar-postgresql',
version='0.1.2',
version='0.2.0',
author='Dmitriy Vlasov',
author_email='[email protected]',

packages=['pg_store'],
include_package_data=True,
install_requires=['aiopg==0.13.0'],
requires=['aiopg', 'pulsar (>= 1.5.4)'],
install_requires=['aiopg==0.16'],
requires=['aiopg (>= 0.16)', 'pulsar (>= 2.0.2)'],

url='https://github.com/scailer/pulsar-postgresql',
license='MIT license',
Expand Down