aio-libs / Aiocassandra
Licence: mit
Simple threaded cassandra wrapper for asyncio
Stars: ✭ 86
Programming Languages
python
139335 projects - #7 most used programming language
Projects that are alternatives of or similar to Aiocassandra
Graylog Plugin Metrics Reporter
Graylog Metrics Reporter Plugins
Stars: ✭ 71 (-17.44%)
Mutual labels: cassandra
Hproxy
hproxy - Asynchronous IP proxy pool, aims to make getting proxy as convenient as possible.(异步爬虫代理池)
Stars: ✭ 62 (-27.91%)
Mutual labels: asyncio
Pyfailsafe
Simple failure handling. Failsafe implementation in Python
Stars: ✭ 70 (-18.6%)
Mutual labels: asyncio
Bitnami Docker Cassandra
Bitnami Docker Image for Cassandra
Stars: ✭ 73 (-15.12%)
Mutual labels: cassandra
Erlcass
High-Performance Erlang Cassandra driver based on DataStax cpp-driver
Stars: ✭ 59 (-31.4%)
Mutual labels: cassandra
Vos backend
vangav open source - backend; a backend generator (generates more than 90% of the code needed for big scale backend services)
Stars: ✭ 71 (-17.44%)
Mutual labels: cassandra
Python Dependency Injector
Dependency injection framework for Python
Stars: ✭ 1,203 (+1298.84%)
Mutual labels: asyncio
Peony Twitter
An asynchronous Twitter API client for Python 3.5+
Stars: ✭ 62 (-27.91%)
Mutual labels: asyncio
Pfun
Functional, composable, asynchronous, type-safe Python.
Stars: ✭ 75 (-12.79%)
Mutual labels: asyncio
Metric Collector For Apache Cassandra
Drop-in metrics collection and dashboards for Apache Cassandra
Stars: ✭ 62 (-27.91%)
Mutual labels: cassandra
Pymarketcap
Python3 API wrapper and web scraper for https://coinmarketcap.com
Stars: ✭ 73 (-15.12%)
Mutual labels: asyncio
Aiomysql
aiomysql is a library for accessing a MySQL database from the asyncio
Stars: ✭ 1,252 (+1355.81%)
Mutual labels: asyncio
aiocassandra
:info: Simple threaded cassandra wrapper for asyncio
.. image:: https://travis-ci.org/aio-libs/aiocassandra.svg?branch=master :target: https://travis-ci.org/aio-libs/aiocassandra
.. image:: https://img.shields.io/pypi/v/aiocassandra.svg :target: https://pypi.python.org/pypi/aiocassandra
.. image:: https://codecov.io/gh/aio-libs/aiocassandra/branch/master/graph/badge.svg :target: https://codecov.io/gh/aio-libs/aiocassandra
Installation
.. code-block:: shell
pip install aiocassandra
Usage
.. code-block:: python
import asyncio
from aiocassandra import aiosession
from cassandra.cluster import Cluster
from cassandra.query import SimpleStatement
# connection is blocking call
cluster = Cluster()
# aiocassandra uses executor_threads to talk to cassndra driver
# https://datastax.github.io/python-driver/api/cassandra/cluster.html?highlight=executor_threads
session = cluster.connect()
async def main():
# patches and adds `execute_future`, `execute_futures` and `prepare_future`
# to `cassandra.cluster.Session`
aiosession(session)
# best way is to use cassandra prepared statements
# https://cassandra-zone.com/prepared-statements/
# https://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Session.prepare
# try to create them once on application init
query = session.prepare('SELECT now() FROM system.local;')
# if non-blocking prepared statements is really needed:
query = await session.prepare_future('SELECT now() FROM system.local;')
print(await session.execute_future(query))
# pagination is also supported
query = 'SELECT * FROM system.size_estimates;'
statement = SimpleStatement(query, fetch_size=100)
# don't miss *s* (execute_futureS)
async with session.execute_futures(statement) as paginator:
async for row in paginator:
print(row)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
cluster.shutdown()
loop.close()
Python 3.5+ is required
Thanks
The library was donated by Ocean S.A. <https://ocean.io/>
_
Thanks to the company for contribution.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].