tarantool / tarantool-python

Python client library for Tarantool
https://www.tarantool.io
BSD 2-Clause "Simplified" License
100 stars 48 forks source link

Execute Sql Support #159

Closed enescaglar closed 3 years ago

enescaglar commented 4 years ago

Hi,

Does this library support executing SQL? I can't find it but just wanted to clarify.

Thanks.

Totktonada commented 4 years ago

AFAIK, @robinhood23rus and @artembo did some work in this direction. Maybe they will update us with current status.

knazarov commented 4 years ago

@artembo has implemented python-compatible DB API. He will create a pull-request eventually. He did it in order to add support for Tarantool in Django ORM (which by the way worked out well enough)

artembo commented 4 years ago

Hi

I partially implemented dpapi2.0 interface for the connector in dbapi module which is enough for running Tarantool with Django using django-tarantool database backend.

All these changes are available on the branch dbapi2 at the moment and will be merged in master soon.

How to get started working with SQL without Django in any Python application:

$ pip install git+https://github.com/tarantool/tarantool-python@dbapi2 

When dbapi module is in the master branch you'll be able to install the package with SQL by pip install tarantool Then you can execute SQL like:

from tarantool.dbapi import Connection

c = Connection('127.0.0.1', 3301, "username", "password")
cursor = c.cursor()
cursor.execute('select * from "space_name"')

data = cursor.fetchall()
enescaglar commented 4 years ago

Thank you all for your answers. It's good to hear, changes will be merged soon.