SAP HANA Connector in pure Python

Overview

SAP HANA Database Client for Python

Important Notice

https://img.shields.io/badge/STATUS-NOT%20CURRENTLY%20MAINTAINED-red.svg?longCache=true&style=flat

This public repository is read-only and no longer maintained.

The active maintained alternative is SAP HANA Python Client: https://pypi.org/project/hdbcli/

A pure Python client for the SAP HANA Database based on the SAP HANA Database SQL Command Network Protocol.

pyhdb supports Python 2.7, 3.3, 3.4, 3.5, 3.6 and also PyPy on Linux, OSX and Windows. It implements a large part of the DBAPI Specification v2.0 (PEP 249).

Table of contents

Install

Install from Python Package Index:

$ pip install pyhdb

Install from GitHub via pip:

$ pip install git+https://github.com/SAP/pyhdb.git

You can also install the latest version direct from a cloned git repository.

$ git clone https://github.com/SAP/pyhdb.git
$ cd pyhdb
$ python setup.py install

Getting started

If you do not have access to a SAP HANA server, go to the SAP HANA Developer Center and choose one of the options to get your own trial SAP HANA Server.

For using PyHDB with hanatrial instance, follow this guide.

The basic pyhdb usage is common to database adapters implementing the DBAPI 2.0 interface (PEP 249). The following example shows how easy it's to use the pyhdb module.

>>> import pyhdb
>>> connection = pyhdb.connect(
    host="example.com",
    port=30015,
    user="user",
    password="secret"
)

>>> cursor = connection.cursor()
>>> cursor.execute("SELECT 'Hello Python World' FROM DUMMY")
>>> cursor.fetchone()
(u"Hello Python World",)

>>> connection.close()

Establish a database connection

The function pyhdb.connect creates a new database session and returns a new Connection instance. Please note that port isn't the instance number of you SAP HANA database. The SQL port of your SAP HANA is made up of 3<instance-number>15 for example the port of the default instance number 00 is 30015.

Currently pyhdb only supports the user and password authentication method. If you need another authentication method like SAML or Kerberos than please open a GitHub issue. Also there is currently no support of encrypted network communication between client and database.

Cursor object

With the method cursor of your Connection object you create a new Cursor object. This object is able to execute SQL statements and fetch one or multiple rows of the resultset from the database.

Example select

>>> cursor = connection.cursor()
>>> cursor.execute("SELECT SCHEMA_NAME, TABLE_NAME FROM TABLES")

After you executed a statement you can fetch one or multiple rows from the resultset.

>>> cursor.fetchone()
(u'SYS', u'DUMMY')

>>> cursor.fetchmany(3)
[(u'SYS', u'DUMMY'), (u'SYS', u'PROCEDURE_DATAFLOWS'), (u'SYS', u'PROCEDURE_MAPPING')]

You can also fetch all rows from your resultset.

>>> cursor.fetchall()
[(u'SYS', u'DUMMY'), (u'SYS', u'PROCEDURE_DATAFLOWS'), (u'SYS', u'PROCEDURE_MAPPING'), ...]

Example Create table

With the execute method you can also execute DDL statements like CREATE TABLE.

>>> cursor.execute('CREATE TABLE PYHDB_TEST("NAMES" VARCHAR (255) null)')

Example insert

You can also execute DML Statements with the execute method like INSERT or DELETE. The Cursor attribute rowcount contains the number of affected rows by the last statement.

>>> cursor.execute("INSERT INTO PYHDB_TEST VALUES('Hello Python World')")
>>> cursor.rowcount
1

LOBs

Three different types of LOBs are supported and corresponding LOB classes have been implemented: * Blob - binary LOB data * Clob - string LOB data containing only ascii characters * NClob - string (unicode for Python 2.x) LOB data containing any valid unicode character

LOB instance provide a file-like interface (similar to StringIO instances) for accessing LOB data. For HANA LOBs lazy loading of the actual data is implemented behind the scenes. An initial select statement for a LOB only loads the first 1024 bytes on the client:

>>> mylob = cursor.execute('select myclob from mytable where id=:1', [some_id]).fetchone()[0]
>>> mylob
<Clob length: 2000 (currently loaded from hana: 1024)>

By calling the read(<num-chars>)-method more data will be loaded from the database once <num-chars> exceeds the number of currently loaded data:

>>> myload.read(1500)   # -> returns the first 1500 chars, by loading extra 476 chars from the db
>>> mylob
<Clob length: 2000 (currently loaded from hana: 1500)>
>>> myload.read()   # -> returns the last 500 chars by loading them from the db
>>> mylob
<Clob length: 2000 (currently loaded from hana: 2000)>

Using the seek() methods it is possible to point the file pointer position within the LOB to arbitrary positions. tell() will return the current position.

LOBs can be written to the database via insert or update-statemens with LOB data provided either as strings or LOB instances:

>>> from pyhdb import NClob
>>> nclob_data = u'朱の子ましける日におえつかうまつ'
>>> nclob = NClob(nclob_data)
>>> cursor.execute('update mynclob set nclob_1=:1, nclob_2=:2 where id=:3', [nclob, nclob_data, myid])

Note

Currently LOBs can only be written in the database for sizes up to 128k (entire amount of data provided in one update or insert statement). This constraint will be removed in one of the next releases of PyHDB. This limitation does however not apply when reading LOB data from the database.

Stored Procedures

Rudimentary support for Stored Procedures call, scalar parameters only:

The script shall call the stored procedure PROC_ADD2 (source below):

>>> sql_to_prepare = 'call PROC_ADD2 (?, ?, ?, ?)'
>>> params = {'A':2, 'B':5, 'C':None, 'D': None}
>>> psid = cursor.prepare(sql_to_prepare)
>>> ps = cursor.get_prepared_statement(psid)
>>> cursor.execute_prepared(ps, [params])
>>> result = cursor.fetchall()
>>> for l in result:
>>>     print l

from the stored procedure:

create procedure PROC_ADD2 (in a int, in b int, out c int, out d char)
language sqlscript
reads sql data as
begin
    c := :a + :b;
    d := 'A';
end

Transaction handling

Please note that all cursors created from the same connection are not isolated. Any change done by one cursor is immediately visible to all other cursors from same connection. Cursors created from different connections are isolated as the connection based on the normal transaction handling.

The connection objects provides to method commit which commit any pending transaction of the connection. The method rollback undo all changes since the last commit.

Contribute

If you found bugs or have other issues than you are welcome to create a GitHub Issue. If you have questions about usage or something similar please create a Stack Overflow Question with tag pyhdb.

Run tests

pyhdb provides a test suite which covers the most use-cases and protocol parts. To run the test suite you need the pytest and mock package. Afterwards just run py.test inside of the root directory of the repository.

$ pip install pytest mock
$ py.test

You can also test different python version with tox.

$ pip install tox
$ tox

Tracing

For debugging purposes it is sometimes useful to get detailed tracing information about packages sent to hana and those received from the database. There are two ways to turn on the print out of tracing information:

  1. Set the environment variable HDB_TRACING=1 before starting Python, e.g. (bash-syntax!):
$ HDB_TRACE=1 python
  1. Import the pyhdb module and set pyhdb.tracing = True

Then perform some statements on the database and enjoy the output.

To get tracing information when running pytest provide the -s option:

$ HDB_TRACE=1 py.test -s

ToDos

  • Allow execution of stored database procedure
  • Support of SELECT FOR UPDATE
  • Authentication methods
    • SAML
    • Kerberos
Comments
  • cesu8 decode error

    cesu8 decode error

    I'm receiving an UnicodeDecodeError error when I try to pull data from HANA using the PyHDB library while iterating through the results in the following code.

    from sqlalchemy import create_engine
    engine = create_engine('hana+pyhdb://%s:%s@%s:%s' % (username, password, host, port))
    connection = engine.connect()
    result = connection.execute("select * from TASKS")
    for row in result.fetchall():
       test = row
    connection.close()
    

    I've narrowed it down to the following snippet.

    import pyhdb.cesu8
    input = b'\xed\xa0\xbd'
    pyhdb.cesu8.decode(input)
    

    Which generates the error:

    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte

    Is this the expected behavior? My assumption is that if the data can be stored in HANA we should be able to read it with the library but my knowledge of utf-8/cesu8 is limited.

    Thanks,

    Jon

    bug need-info 
    opened by jstorryefx 20
  • Allow encrypted connections

    Allow encrypted connections

    This is required for working with SAP CF "HANA as a service" https://jam4.sapjam.com/groups/uc0iP4nx2f9Gm9VsksODsy

    I also increased the maximal message size since we found this to be too low in some cases.

    See https://github.com/SAP/PyHDB/issues/107

    opened by rlindner81 12
  • [FIX] resurrected python2.6 support

    [FIX] resurrected python2.6 support

    Hi,

    although it is stated on the website. PyHDB doesn't work with Python 2.6 due to some dependencies on features introduced in 2.7. I replaced by 2.6 features and now it works for me.

    Cheers, David

    opened by weese 12
  • fetchmany fails when the result includes values of the type REAL

    fetchmany fails when the result includes values of the type REAL

    Hi, the following error is thrown every time the result of a query includes REAL values.

    /pyhdb/protocol/types.py", line 187, in from_resultset return cls._struct.unpack(payload)[0] struct.error: unpack requires a string argument of length 4

    opened by krichly 9
  • Connection error

    Connection error

    Receiving a interesting error when trying to do a insert into SPS12 from Python 3.5: Traceback (most recent call last): File "C:\Users\sap\Anaconda3\lib\site-packages\pyhdb-0.3.1-py3.5.egg\pyhdb\connection.py", line 108, in __send_message_recv_reply _payload = self._socket.recv(header.payload_length - payload.tell()) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "Coon_test.py", line 21, in connection.close() File "C:\Users\sap\Anaconda3\lib\site-packages\pyhdb-0.3.1-py3.5.egg\pyhdb\connection.py", line 168, in close reply = self.send_request(request) File "C:\Users\sap\Anaconda3\lib\site-packages\pyhdb-0.3.1-py3.5.egg\pyhdb\connection.py", line 84, in send_request return self.__send_message_recv_reply(payload.getvalue()) File "C:\Users\sap\Anaconda3\lib\site-packages\pyhdb-0.3.1-py3.5.egg\pyhdb\connection.py", line 121, in __send_message_recv_reply raise OperationalError("Lost connection to HANA server (%r)" % error) pyhdb.exceptions.OperationalError: Lost connection to HANA server (ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

    Any thoughts?

    opened by liverpool333 8
  • LookupError: unknown encoding: cesu-8

    LookupError: unknown encoding: cesu-8

    Trying to connect to SAP HANA give error: Traceback (most recent call last): File "C:\Users\u210990\IdeaProjects\wp3_daten_transfer\lesen_daten_hana.py", line 22, in connection(host, port, user, pwd, sql) File "C:\Users\u210990\IdeaProjects\wp3_daten_transfer\lesen_daten_hana.py", line 16, in connection connection_parameter = pyhdb.connect(host=host_conn, port=port_conn, user=user_conn, File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb_init_.py", line 30, in connect conn.connect() File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\connection.py", line 141, in connect agreed_auth_part = self._auth_manager.perform_handshake() File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\auth.py", line 50, in perform_handshake response = self.connection.send_request(request) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\connection.py", line 83, in send_request payload = message.pack() # obtain BytesIO instance File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\message.py", line 55, in pack self.build_payload(payload) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\message.py", line 45, in build_payload segment.pack(payload, commit=self.autocommit) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\segments.py", line 94, in pack self.build_payload(payload) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\segments.py", line 80, in build_payload part_payload = part.pack(remaining_size) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\parts.py", line 103, in pack arguments_count, payload = self.pack_data(remaining_size - self.header_size) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\parts.py", line 591, in pack_data payload = Fields.pack_data(fields) File "c:\devsbb\eaio\python3\lib\site-packages\pyhdb\protocol\parts.py", line 48, in pack_data field = field.encode('cesu-8') LookupError: unknown encoding: cesu-8

    I'm not sure if it is related to the python version 3.9?

    opened by DanieleMele 7
  • Add 'named' parameter style

    Add 'named' parameter style

    This makes it possible to use question marks and named tags as placeholders in queries, e.g. cursor.execute("INSERT INTO TEST VALUES(?)", ("'Hello World'",)) and cursor.execute("INSERT INTO TEST VALUES(:hello)", dict(hello="'Hello World'")) This fixes issue #8.

    opened by 0x203 7
  • Pyhdb.connect fails because of Unknown Option Type

    Pyhdb.connect fails because of Unknown Option Type

    Hi all,

    It threw the following error while connecting:

    Traceback (most recent call last): File "", line 5, in File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/init.py", line 10, in connect connection.connect() File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/client.py", line 126, in connect ConnectOptions(DEFAULT_CONNECTION_OPTIONS) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/protocol/base.py", line 87, in send return self.connection._send_message(self.pack()) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/client.py", line 96, in _send_message return Message.unpack_reply(self, header, payload) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/protocol/base.py", line 98, in unpack_reply payload, expected_segments=header[4] File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/protocol/base.py", line 216, in unpack_from yield ReplySegment.unpack(segment_header, segment_payload) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/protocol/base.py", line 232, in unpack tuple(Part.unpack_from(payload, expected_parts=header[2])) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/protocol/base.py", line 307, in unpack_from part_header[2], part_payload File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyhdb/protocol/parts.py", line 111, in unpack_data raise Exception("Unknown option type %s" % typ) Exception: Unknown option type 30

    Please fix this.

    opened by jayanthkmr 7
  • Python and HCP Trial connectivity issue.

    Python and HCP Trial connectivity issue.

    I am trying to establish a connection with my HCP trail account from python but facing the below issue:

    capture

    The code snippet i used to establish this connection is :

    import dbapi

    conn = dbapi.connect( 'hanatrial.ondemand.com' , 30015, 'p1942054738', 'xxxxxx')

    print ( conn.isconnected())

    Please note :

    • i have placed this code under python folder of hdbclient.

    • I have copied these files into the Lib folder of python

            * __init__.py, dbapi.py, resultrow.py
      
            * pyhdbcli.pdb, pyhdbcli.pyd
      

    Please let me know what am i missing to establish a connection between HCP and python.

    opened by Vigneshbosch 6
  • Append local buffer only if value is present instead exception during…

    Append local buffer only if value is present instead exception during…

      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 874, in commit
        self.transaction.commit()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 461, in commit
        self._prepare_impl()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 441, in _prepare_impl
        self.session.flush()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2139, in flush
        self._flush(objects)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2259, in _flush
        transaction.rollback(_capture_exception=True)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
        compat.reraise(exc_type, exc_value, exc_tb)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
        raise value
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2223, in _flush
        flush_context.execute()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
        rec.execute(self)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
        uow
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
        mapper, table, insert)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
        execute(statement, params)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 945, in execute
        return meth(self, multiparams, params)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
        return connection._execute_clauseelement(self, multiparams, params)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
        compiled_sql, distilled_params
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
        context)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1396, in _handle_dbapi_exception
        util.reraise(*exc_info)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
        raise value
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
        context)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
        cursor.execute(statement, parameters)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/cursor.py", line 260, in execute
        self.executemany(statement, parameters=[parameters])
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/cursor.py", line 284, in executemany
        self.execute_prepared(prepared_statement, parameters)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/cursor.py", line 189, in execute_prepared
        reply = self.connection.send_request(request)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/connection.py", line 83, in send_request
        payload = message.pack()  # obtain BytesIO instance
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/message.py", line 55, in pack
        self.build_payload(payload)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/message.py", line 45, in build_payload
        segment.pack(payload, commit=self.autocommit)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/segments.py", line 94, in pack
        self.build_payload(payload)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/segments.py", line 80, in build_payload
        part_payload = part.pack(remaining_size)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/parts.py", line 103, in pack
        arguments_count, payload = self.pack_data(remaining_size - self.header_size)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/parts.py", line 509, in pack_data
        lob_buffer = LobBuffer(value, _DataType, lob_header_pos)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/parts.py", line 448, in __init__
        enc_data = orig_data.encode()
    AttributeError: 'NoneType' object has no attribute 'encode'
    

    after

        db.commit()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/scoping.py", line 157, in do
        return getattr(self.registry(), name)(*args, **kwargs)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 874, in commit
        self.transaction.commit()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 461, in commit
        self._prepare_impl()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 441, in _prepare_impl
        self.session.flush()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2139, in flush
        self._flush(objects)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2259, in _flush
        transaction.rollback(_capture_exception=True)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
        compat.reraise(exc_type, exc_value, exc_tb)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
        raise value
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/session.py", line 2223, in _flush
        flush_context.execute()
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
        rec.execute(self)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
        uow
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
        mapper, table, insert)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
        execute(statement, params)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 945, in execute
        return meth(self, multiparams, params)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
        return connection._execute_clauseelement(self, multiparams, params)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
        compiled_sql, distilled_params
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
        context)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1393, in _handle_dbapi_exception
        exc_info
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
        reraise(type(exception), exception, tb=exc_tb, cause=cause)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
        raise value.with_traceback(tb)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
        context)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
        cursor.execute(statement, parameters)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/cursor.py", line 260, in execute
        self.executemany(statement, parameters=[parameters])
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/cursor.py", line 284, in executemany
        self.execute_prepared(prepared_statement, parameters)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/cursor.py", line 189, in execute_prepared
        reply = self.connection.send_request(request)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/connection.py", line 84, in send_request
        return self.__send_message_recv_reply(payload.getvalue())
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/connection.py", line 124, in __send_message_recv_reply
        return ReplyMessage.unpack_reply(header, payload)
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/message.py", line 92, in unpack_reply
        segments=tuple(ReplySegment.unpack_from(payload, expected_segments=header.num_segments)),
      File "/Users/michaelkuty/projects/stories/lib/python3.5/site-packages/pyhdb/protocol/segments.py", line 152, in unpack_from
        raise error.parts[0].errors[0]
    sqlalchemy.exc.DatabaseError: (pyhdb.exceptions.DatabaseError) inserted value too large for column: Stories [SQL: 'INSERT INTO companies (id, created, updated, extra, name, token) VALUES (?, ?, ?, ?, ?, ?)'] [parameters: (23, datetime.datetime(2017, 3, 14, 0, 27, 19, 887477), datetime.datetime(2017, 3, 14, 0, 27, 19, 887494), '{}', 'Stories', None)]
    
    missing-tests 
    opened by michaelkuty 6
  • connect to tenant database fails

    connect to tenant database fails

    while try to connect to a tenant db in hana like: connection = pyhdb.connect( host="example.com", port=30015, user="user", password="secret", database='db1' )

    it fails with error as - TypeError: connect() got an unexpected keyword argument 'database'

    note that replacing "database" with "dbname" would fail too, any tips?

    opened by hong5698 6
Releases(v0.3.4)
  • v0.3.4(Feb 16, 2018)

  • v0.3.1(Nov 18, 2015)

  • v0.3.0(Oct 29, 2015)

    • Added LOB_WRITE requests allowing to insert or update LOBs of arbitrary size
    • Added support of SELECT FOR UPDATE statements
    • Added support of Geometry types
    • Added support for procedures with resultsets
    • Fixed and improved Real, BigInt, Time and Date types
    • Code cleanup and refactoring
    • Renamed logger form receive to pyhdb
    • Reactivated unit tests which were deactivated by accident
    • Added pyhdb.connect.from_ini() to connect to db with parameters from properly formatted ini file
    Source code(tar.gz)
    Source code(zip)
Owner
SAP Archive
Retired and frozen projects of SAP. Feel free to fork and continue using them on your own.
SAP Archive
MySQL database connector for Python (with Python 3 support)

mysqlclient This project is a fork of MySQLdb1. This project adds Python 3 support and fixed many bugs. PyPI: https://pypi.org/project/mysqlclient/ Gi

PyMySQL 2.2k Dec 25, 2022
MariaDB connector using python and flask

MariaDB connector using python and flask This should work with flask and to be deployed on docker. Setting up stuff 1. Docker build and run docker bui

Bayangmbe Mounmo 1 Jan 11, 2022
Pure Python MySQL Client

PyMySQL Table of Contents Requirements Installation Documentation Example Resources License This package contains a pure-Python MySQL client library,

PyMySQL 7.2k Jan 9, 2023
Pure-python PostgreSQL driver

pg-purepy pg-purepy is a pure-Python PostgreSQL wrapper based on the anyio library. A lot of this library was inspired by the pg8000 library. Credits

Lura Skye 11 May 23, 2022
Python interface to Oracle Database conforming to the Python DB API 2.0 specification.

cx_Oracle version 8.2 (Development) cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database

Oracle 841 Dec 21, 2022
PubMed Mapper: A Python library that map PubMed XML to Python object

pubmed-mapper: A Python Library that map PubMed XML to Python object 中文文档 1. Philosophy view UML Programmatically access PubMed article is a common ta

灵魂工具人 33 Dec 8, 2022
python-beryl, a Python driver for BerylDB.

python-beryl, a Python driver for BerylDB.

BerylDB 3 Nov 24, 2021
A supercharged SQLite library for Python

SuperSQLite: a supercharged SQLite library for Python A feature-packed Python package and for utilizing SQLite in Python by Plasticity. It is intended

Plasticity 703 Dec 30, 2022
ClickHouse Python Driver with native interface support

ClickHouse Python Driver ClickHouse Python Driver with native (TCP) interface support. Asynchronous wrapper is available here: https://github.com/myma

Marilyn System 957 Dec 30, 2022
DataStax Python Driver for Apache Cassandra

DataStax Driver for Apache Cassandra A modern, feature-rich and highly-tunable Python client library for Apache Cassandra (2.1+) and DataStax Enterpri

DataStax 1.3k Dec 25, 2022
Python client for Apache Kafka

Kafka Python client Python client for the Apache Kafka distributed stream processing system. kafka-python is designed to function much like the offici

Dana Powers 5.1k Jan 8, 2023
PyMongo - the Python driver for MongoDB

PyMongo Info: See the mongo site for more information. See GitHub for the latest source. Documentation: Available at pymongo.readthedocs.io Author: Mi

mongodb 3.7k Jan 8, 2023
Redis Python Client

redis-py The Python interface to the Redis key-value store. Python 2 Compatibility Note redis-py 3.5.x will be the last version of redis-py that suppo

Andy McCurdy 11k Dec 29, 2022
Motor - the async Python driver for MongoDB and Tornado or asyncio

Motor Info: Motor is a full-featured, non-blocking MongoDB driver for Python Tornado and asyncio applications. Documentation: Available at motor.readt

mongodb 2.1k Dec 26, 2022
A fast PostgreSQL Database Client Library for Python/asyncio.

asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio asyncpg is a database interface library designed specifically for PostgreSQL a

magicstack 5.8k Dec 31, 2022
Motor - the async Python driver for MongoDB and Tornado or asyncio

Motor Info: Motor is a full-featured, non-blocking MongoDB driver for Python Tornado and asyncio applications. Documentation: Available at motor.readt

mongodb 1.6k Feb 6, 2021
Redis client for Python asyncio (PEP 3156)

Redis client for Python asyncio. Redis client for the PEP 3156 Python event loop. This Redis library is a completely asynchronous, non-blocking client

Jonathan Slenders 554 Dec 4, 2022
Asynchronous Python client for InfluxDB

aioinflux Asynchronous Python client for InfluxDB. Built on top of aiohttp and asyncio. Aioinflux is an alternative to the official InfluxDB Python cl

Gustavo Bezerra 159 Dec 27, 2022
GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.

GINO - GINO Is Not ORM - is a lightweight asynchronous ORM built on top of SQLAlchemy core for Python asyncio. GINO 1.0 supports only PostgreSQL with

GINO Community 2.5k Dec 27, 2022