-
Notifications
You must be signed in to change notification settings - Fork 111
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
async support #263
Comments
This is on the way for the next version of the Python client. |
That's great to hear @rbotzer - any ETA on that release? It looks like it's been quite a while since 6.0.0. |
is there any update on this ? |
🙏🏿 |
Poke 🖤 |
🙏🏿 |
is there any update? since #462 Looking forward to async support 🙏 P.S. I always thanks to Aerospike Team for great opensource |
Hey, is there any update? |
In all likelihood, someone will develop a new database, written in, say, rust with native, say, rust bindings and then it will be trivial to map those to Python. |
the new client will be a layer on top of a rust base, see aerospike/aerospike-client-rust#147 (comment) in the meantime, simply make all aerospike calls in a thread pool, which is what i've been doing since asking this question, here's the code, which is on python 3.9, but should be easy to upgrade class AerospikeClient:
def __init__(self, address):
self._address = address
async def connect(self) -> None:
hosts = list()
for addr in self._address.split(','):
host, port = addr.split(':')
hosts.append((host, int(port)))
connect_args = dict()
if username := os.getenv('AEROSPIKE_USERNAME'):
connect_args['user'] = username
connect_args['policies'] = {'auth_mode': aerospike.AUTH_INTERNAL},
connect_args['password'] = os.getenv('AEROSPIKE_PASSWORD')
if len(hosts) > 1:
connect_args['shm'] = {}
self._aerospike = aerospike.client({
'hosts': hosts,
'use_shared_connection': True,
**connect_args
})
# TODO: can get rid of this when client is async
class async_aerospike:
def __init__(self, a):
self._aerospike = a
self._loop = None
@property
def loop(self):
if not self._loop:
self._loop = asyncio.get_running_loop()
return self._loop
def __getattr__(self, attr: str):
async def meth(*args, **kwargs):
return await self.loop.run_in_executor(
None,
functools.partial(
getattr(self._aerospike, attr), *args, **kwargs
),
)
return meth
self.aerospike: aerospike.Client = async_aerospike(self._aerospike)
await self.aerospike.connect()
async def disconnect(self) -> None:
await self.aerospike.close()
@property
def connected(self) -> bool:
return self._aerospike.is_connected()
def __getattr__(self, attr: str):
return getattr(self.aerospike, attr) |
Async support is not coming in 2024 and we don’t have a delivery date scheduled yet, but we will respond back again once we solidify our 2025 roadmap |
This is a bump for these 2 old issues #51, #52.
Based on this comment #52 (comment), it sounds like async C support was the prereq for adding async python support which seems to have been added a few months ago. Has there been any progress on async python support? Thanks!
The text was updated successfully, but these errors were encountered: