All Projects → aio-libs → Aioodbc

aio-libs / Aioodbc

Licence: apache-2.0
aioodbc - is a library for accessing a ODBC databases from the asyncio

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Aioodbc

Freesql
🦄 .NET orm, Mysql orm, Postgresql orm, SqlServer orm, Oracle orm, Sqlite orm, Firebird orm, 达梦 orm, 人大金仓 orm, 神通 orm, 翰高 orm, 南大通用 orm, Click house orm, MsAccess orm.
Stars: ✭ 3,077 (+1393.69%)
Mutual labels:  oracle, odbc, mysql, postgresql, sqlite
Eosio sql plugin
EOSIO sql database plugin
Stars: ✭ 21 (-89.81%)
Mutual labels:  oracle, odbc, mysql, postgresql, sqlite
Sqitch
Sensible database change management
Stars: ✭ 2,320 (+1026.21%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Soci
Official repository of the SOCI - The C++ Database Access Library
Stars: ✭ 960 (+366.02%)
Mutual labels:  oracle, odbc, mysql, postgresql
Chloe
A lightweight and high-performance Object/Relational Mapping(ORM) library for .NET --C#
Stars: ✭ 1,248 (+505.83%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Kangaroo
SQL client and admin tool for popular databases
Stars: ✭ 127 (-38.35%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (+1141.75%)
Mutual labels:  asyncio, mysql, postgresql, sqlite
Rom Sql
SQL support for rom-rb
Stars: ✭ 169 (-17.96%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Sqlprovider
A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
Stars: ✭ 423 (+105.34%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (-14.56%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Qtl
A friendly and lightweight C++ database library for MySQL, PostgreSQL, SQLite and ODBC.
Stars: ✭ 92 (-55.34%)
Mutual labels:  odbc, mysql, postgresql, sqlite
Adminer Custom
Customizations for Adminer, the best database management tool written in PHP.
Stars: ✭ 99 (-51.94%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+276.21%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Zxw.framework.netcore
基于EF Core的Code First模式的DotNetCore快速开发框架,其中包括DBContext、IOC组件autofac和AspectCore.Injector、代码生成器(也支持DB First)、基于AspectCore的memcache和Redis缓存组件,以及基于ICanPay的支付库和一些日常用的方法和扩展,比如批量插入、更新、删除以及触发器支持,当然还有demo。欢迎提交各种建议、意见和pr~
Stars: ✭ 691 (+235.44%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+12792.72%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Zabbixdba
Zabbix Database Monitoring Service (Oracle, Pg, MySQL, MS SQL, DB2, etc.)
Stars: ✭ 68 (-66.99%)
Mutual labels:  oracle, odbc, mysql, postgresql
Directus
Open-Source Data Platform 🐰 — Directus wraps any SQL database with a real-time GraphQL+REST API and an intuitive app for non-technical users.
Stars: ✭ 13,190 (+6302.91%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Entityframework.exceptions
Handle database errors easily when working with Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql
Stars: ✭ 266 (+29.13%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Dbeaver
Free universal database tool and SQL client
Stars: ✭ 23,752 (+11430.1%)
Mutual labels:  oracle, mysql, postgresql, sqlite
Xeus Sql
xeus-sql is a Jupyter kernel for general SQL implementations.
Stars: ✭ 85 (-58.74%)
Mutual labels:  odbc, mysql, postgresql, sqlite

aioodbc

.. image:: https://travis-ci.com/aio-libs/aioodbc.svg?branch=master :target: https://travis-ci.com/aio-libs/aioodbc .. image:: https://coveralls.io/repos/aio-libs/aioodbc/badge.svg?branch=master&service=github :target: https://coveralls.io/github/aio-libs/aioodbc?branch=master .. image:: https://img.shields.io/pypi/v/aioodbc.svg :target: https://pypi.python.org/pypi/aioodbc .. image:: https://badges.gitter.im/Join%20Chat.svg :target: https://gitter.im/aio-libs/Lobby :alt: Chat on Gitter

aioodbc is a Python 3.5+ module that makes it possible to access ODBC_ databases with asyncio_. It relies on the awesome pyodbc_ library and preserves the same look and feel. aioodbc was written using async/await syntax (PEP492_) and thus is not compatible with Python versions older than 3.5. Internally aioodbc employs threads to avoid blocking the event loop, threads_ are not that as bad as you think!. Other drivers like motor_ use the same approach.

aioodbc is fully compatible and tested with uvloop_. Take a look at the test suite, all tests are executed with both the default event loop and uvloop_.

Supported Databases

aioodbc should work with all databases supported by pyodbc_. But for now the library has been tested with: SQLite, MySQL and PostgreSQL. Feel free to add other databases to the test suite by submitting a PR.

Community

Mailing List: https://groups.google.com/forum/#!forum/aio-libs

Chat room: https://gitter.im/aio-libs/Lobby

Basic Example

aioodbc is based on pyodbc_ and provides the same api, you just need to use yield from conn.f() or await conn.f() instead of conn.f()

Properties are unchanged, so conn.prop is correct as well as conn.prop = val.

.. code:: python

import asyncio
import aioodbc


loop = asyncio.get_event_loop()


async def test_example():
    dsn = 'Driver=SQLite;Database=sqlite.db'
    conn = await aioodbc.connect(dsn=dsn, loop=loop)

    cur = await conn.cursor()
    await cur.execute("SELECT 42 AS age;")
    rows = await cur.fetchall()
    print(rows)
    print(rows[0])
    print(rows[0].age)
    await cur.close()
    await conn.close()

loop.run_until_complete(test_example())

Connection Pool

Connection pooling is ported from aiopg_ and relies on PEP492_ features:

.. code:: python

import asyncio
import aioodbc


loop = asyncio.get_event_loop()


async def test_pool():
    dsn = 'Driver=SQLite;Database=sqlite.db'
    pool = await aioodbc.create_pool(dsn=dsn, loop=loop)

    async with pool.acquire() as conn:
        cur = await conn.cursor()
        await cur.execute("SELECT 42;")
        r = await cur.fetchall()
        print(r)
        await cur.close()
        await conn.close()
    pool.close()
    await pool.wait_closed()

loop.run_until_complete(test_pool())

Context Managers

Pool, Connection and Cursor objects support the context management protocol:

.. code:: python

import asyncio
import aioodbc


loop = asyncio.get_event_loop()


async def test_example():
    dsn = 'Driver=SQLite;Database=sqlite.db'

    async with aioodbc.create_pool(dsn=dsn, loop=loop) as pool:
        async with pool.acquire() as conn:
            async with conn.cursor() as cur:
                await cur.execute('SELECT 42 AS age;')
                val = await cur.fetchone()
                print(val)
                print(val.age)

loop.run_until_complete(test_example())

Installation

In a linux environment pyodbc_ (hence aioodbc) requires the unixODBC_ library. You can install it using your package manager, for example::

  $ sudo apt-get install unixodbc
  $ sudo apt-get install unixodbc-dev

then::

pip install aioodbc

Run tests

For testing purposes you need to install docker_ and the development requirements::

$ pip install -r requirements-dev.txt

In order to simplify development you should install the provided docker container. This way you don't need to install any databases or other system libraries, everything happens inside the container.

Then just execute::

$ make docker_build
$ make docker_test

The test will automatically pull images and build containers with the required databases.

NOTE: Running tests requires Python 3.6 or higher.

Other SQL Drivers

  • aiopg_ - asyncio client for PostgreSQL
  • aiomysql_ - asyncio client form MySQL

Requirements

  • Python_ 3.5+
  • pyodbc_
  • uvloop_ (optional)

.. _Python: https://www.python.org .. _asyncio: http://docs.python.org/3.4/library/asyncio.html .. _pyodbc: https://github.com/mkleehammer/pyodbc .. _uvloop: https://github.com/MagicStack/uvloop .. _ODBC: https://en.wikipedia.org/wiki/Open_Database_Connectivity .. _aiopg: https://github.com/aio-libs/aiopg .. _aiomysql: https://github.com/aio-libs/aiomysql .. _PEP492: https://www.python.org/dev/peps/pep-0492/ .. _unixODBC: http://www.unixodbc.org/ .. _threads: http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/ .. _docker: https://docs.docker.com/engine/installation/ .. _motor: https://emptysqua.re/blog/motor-0-7-beta/

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].