Giter Club home page Giter Club logo

nuodb-python's People

Contributors

acharis avatar adriansuarez avatar bnouvel-wio avatar czarlos avatar danweiss avatar db2882 avatar dukenuodb avatar eresende-nuodb avatar jgetto avatar khicks-nuodb avatar lbayas avatar madscientist avatar mjmichaels avatar mkysel avatar mricenuodb avatar nbagley2 avatar nexflare avatar nuoandym84 avatar philip-stoev avatar rshaull avatar shilliardnuodb avatar thebithead avatar treilly-nuodb avatar tvincentnuodb avatar vduda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nuodb-python's Issues

aborted operations need to clean up the __output

I tried to add a test to perform an invalid batch operation and got my exception but then the next operation crashed on the nice raise SessionException('no') when trying to do the next _putMessageId

Doesn't understand 'binary varying' datatype

Create a table like this:

        sql.execute("CREATE TABLE t1_binary ( f1 BINARY, f2 BINARY(5), f3 VARBINARY(5), f4 BINARY LARGE OBJECT, f5 BLOB (5K));")
        sql.execute("INSERT INTO t1_binary VALUES ('a',0x12345678,'abc','abc','abc');")

And then try to select * from it over the pynuodb driver, you get:
DataError: 'received unknown column type from the database "binary varying"'

Optimize Cursor.fetchmany and Cursor.fetchall

Currently Cursor.fetchmany and Cursor.fetchall work by calling Cursor.fetchone the appropriate number of times. This ok, since fetchone gets results from the server in chunks and only makes another request to the server when the current chunk is exhausted. However, as an optimization fetchmany and fetchall could immediately fetch the appropriate number of rows from the database.

README should link to PEP 249

The README is very minimal: it should specify that nuodb-python intends to comply with PEP 249 and provide a link to it, so users can get more details easily.

Process.query attempts to get database credentials from agent, needs to use broker

Traceback (most recent call last):
File "/home/treilly/nuodb/DebugTools/memprof.py", line 32, in
str = p.query("Memory", ElementTree.fromstring(""))
File "/usr/local/lib/python2.7/dist-packages/pynuodb/entity.py", line 951, in query
"Database" : self.database.name })
File "/usr/local/lib/python2.7/dist-packages/pynuodb/session.py", line 149, in doRequest
checkForError(response)
File "/usr/local/lib/python2.7/dist-packages/pynuodb/session.py", line 56, in checkForError
raise SessionException(root.get("text"))
pynuodb.session.SessionException: 'Unknown management type: GetDatabaseCredentials'

execute_batch_prepared_statement doesn't handle errors correctly

Every row in the param list can succeed or fail independently and the client needs to be able to know which failed and which succeeded. It appears the current implemenatation will fail to read all the data which can lead to data left in the connection and result in protocol errors. In JDBC you use BatchUpdateException.getUpdateCounts() to get the results for all operations to figure out which failed and which proceeded. In JDBC a database can chose to stop after the first failure but NuoDB doesn't do that and the protocol is that a result is returned for each element of the batch (with an extra int and string if the result is -3).

Retrieving Real, Float or Double Precision using the Python Driver throws; struct.error

The code below will throw the following error when attempting to retrieve the Double Precision datatype from the Employee Table.

ERROR:

Traceback (most recent call last):
File "pynuodbDblPrecision.py", line 28, in
cursor.execute("select * from employee")
File "/Library/Python/2.7/site-packages/pynuodb/cursor.py", line 118, in execute
row[i] = self.session.getValue()
File "/Library/Python/2.7/site-packages/pynuodb/encodedsession.py", line 443, in getValue
return self.getDouble()
File "/Library/Python/2.7/site-packages/pynuodb/encodedsession.py", line 317, in getDouble
return struct.unpack('d', self._takeBytes(typeCode - 77))[0]
struct.error: unpack requires a string argument of length 8

CODE

import pynuodb

# open database connecton
connection = pynuodb.connect("test", "localhost", "dba", "goalie", schema='hockey')

#  Prepare the cursor object 
cursor = connection.cursor()

# Drop table if it already exist using execute() method.
cursor.execute("DROP TABLE IF EXISTS EMPLOYEE")

#Create Table
cursor.execute("CREATE TABLE EMPLOYEE(FIRST_NAME CHAR (20) NOT NULL, LAST_NAME CHAR (20),INCOME DOUBLE PRECISION)")

#Insert 
cursor.execute("INSERT INTO EMPLOYEE (FIRST_NAME,LAST_NAME,INCOME)VALUES('August','Adamonis',2000000)")

connection.commit()

cursor.execute("select * from employee")

# Print the output  
print cursor.fetchall()

# disconnect from server
connection.close()

NOTE: the error will occur if Real, Float or Double Precision are used.

The tests need to be rewritten to no longer use the pynuodb.entity module (deprecated in NuoDB 4.0)

Current the test suite for nuodb-python uses the pynuodb.entity module to create and manage a database for the test. This is no longer feasible since the NuoDB Agent layer is deprecated in NuoDB 4.0 and will be obsolete in an upcoming release.

The tests need to be rewritten to either (a) use the pynuoadmin module to create and manage the database, or (b) presume that an appropriate database has already been created and use that for testing.

Python tests fail against current master

python run_tests.py
...........F.......F...................................................
======================================================================
FAIL: test_param_date_types (tests.nuodb_basic_test.NuoDBBasicTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/philips/git/nuodb-python/tests/nuodb_basic_test.py", line 465, in test_param_date_types
    self.assertEqual(row[2].hour, test_vals[1].hour)
AssertionError: 10 != 0

======================================================================
FAIL: test_string_into_number (tests.nuodb_basic_test.NuoDBBasicTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/philips/git/nuodb-python/tests/nuodb_basic_test.py", line 287, in test_string_into_number
    self.assertEqual(row[0], decimal.Decimal(test_vals[0]))
AssertionError: '54.4978' != Decimal('54.4978')

----------------------------------------------------------------------
Ran 71 tests in 13.016s

sending a scaled time as a unsigned byte string?

Is sending a scaled time as a unsigned byte string correct?

valueStr = toByteString(ticks)

Let's assume the time we're trying to encode is 1 minute after midnight, local time; local time offset is negative 1 hour (perhaps we're in Western Europe).

Here we add the offset of the local timezone, which is negative (as described in the python documentation, offsets may be negative). So now our value is (-59 minutes * 60 seconds/minute) = -3540. Then we use toByteString to encode that negative value.

I have not tested any of this by hand, but this seems like a possible error to me.

The dotnet driver encodes scaled time as a signed byte string, if I'm reading it correctly.

Connection does not validate schema argument...

The connection module does not validate the schema argument when connecting to the database.

E.G.

import pynuodb

connection = pynuodb.connect(database="test", host="localhost", user="dba", password="goalie", schema='SPAM')
connection.close()

The above example does not throw an error however, arguably, it should since the other arguments are validated when the connection is made and throw an appropriate error.

Schema is validated if the code has an actual query which makes sense since schema is in use;

E.G.

import pynuodb

connection = pynuodb.connect(database="test", host="localhost", user="dba", password="goalie", schema='SPAM')
cursor = connection.cursor()
cursor.arraysize = 3
cursor.execute("select * from hockey")
print cursor.fetchone()

ERROR
Traceback (most recent call last):
File "/Users/dadamonis/Documents/nuoDB/python/testDriver.py", line 6, in
cursor.execute("select * from hockey")
File "/Library/Python/2.7/site-packages/pynuodb/cursor.py", line 92, in execute
self._execute(operation)
File "/Library/Python/2.7/site-packages/pynuodb/cursor.py", line 164, in _execute
self.session.exchangeMessages()
File "/Library/Python/2.7/site-packages/pynuodb/encodedsession.py", line 492, in
exchangeMessages
raise DatabaseError('Non-zero status: %s' % self.getString())
pynuodb.exception.DatabaseError: 'Non-zero status: can't find table "HOCKEY"\nSQL:
select * from hockey'

Vastly different exceptions thrown for different errors on connect

For different errors in connect(), vastly different exceptions are thrown. I think it may be better to standardize them somehow so that they can all be handled uniformly:

  • wrong database - SessionException
  • wrong host - gaierror: [Errno -2] Name or service not known
  • wrong password - SessionException: 'Session was closed while receiving'
  • wrong user - ProgrammingError: 'SECURITY_ERROR: "nosuchuser" is not a known user for database "test"'

connect() parameters need to be changed

The top-level connect() function needs to take a different argument list:

  • it should not have a port paramater
  • it should not take a schema parameter
  • it must take a map (or list of key-value pairs)

The key-value pairs are the properties that we allow on a client connection. The properties cannot be hidden behind this routine, because there are many cases where the caller needs to pass them in.

If the schema needs to be specified for some reason then let's talk about what the default should be and why. Right now this is following different behavior than our other drivers.

con.auto_commit = False does not work

con.auto_commit = False does not cause autocommit to be disabled:

        con = self._connect();
        con.auto_commit = False;
        self.assertEquals(con.auto_commit, False);

        cursor1.execute("INSERT INTO autocommit_set VALUES (1)");
        cursor2.execute("SELECT COUNT(*) FROM autocommit_set");
        self.assertEquals(cursor2.fetchone()[0], 0);

Entity database shutdown error on windows

Shutting down a database on windows causes the follow error:

Traceback (most recent call last):
File "tests/nuodb_entity_test.py", line 27, in setUp
self._cleanup(domain)
File "tests/nuodb_entity_test.py", line 338, in _cleanup
db.shutdown()
File "c:\Python27\lib\site-packages\pynuodb\entity.py", line 467, in shutdown
self.quiesce()
File "c:\Python27\lib\site-packages\pynuodb\entity.py", line 502, in quiesce
self.__name, DatabaseAction.Quiesce)
File "c:\Python27\lib\site-packages\pynuodb\util.py", line 106, in doDatabaseA
ction
checkForError(response)
File "c:\Python27\lib\site-packages\pynuodb\session.py", line 56, in checkForE
rror
raise SessionException(root.get("text"))
SessionException: 'WIN-LCFGI29L425.localdomain'

execute() does not fail if an incorrect number of parameters is specified

Statements such as:

    cursor.execute("SELECT ? FROM DUAL");
    cursor.execute("SELECT ?, ? FROM DUAL", []);

must fail with an exception such as "wrong number of parameters specified, expected X got Y". Otherwise, simple typos may lead to data loss or wrong results.

Others fail with an exception "TypeError: init() takes exactly 2 arguments (1 given)" which is not very informative.

Python 3 Test Failures in Crypt

The one issue all tests run into when running with Python 3:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pynuodb/entity.py:69: in __init__
    self.__session.authorize(domain_user, domain_pwd)
pynuodb/session.py:110: in authorize
    cp = ClientPassword()
pynuodb/crypt.py:135: in __init__
    self.__group = RemoteGroup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pynuodb.crypt.RemoteGroup object at 0x101efe518>
primeStr = 'EEAF0AB9ADB38DD69C33F80AFA8FC5E86072618775FF3C0B9EA2314C9C256576D674DF7496EA81D3383B4813D692C6E0E0D5D8E250B98BE48E495...54D6B6CE8EF4AD69B15D4982559B297BCF1885C529F566660E57EC68EDBC3C05726CC02FD4CBF4976EAA9AFD5138FE8376435B9FC61D2FC0EB06E3'
generatorStr = '2'

    def __init__(self, primeStr=defaultPrime, generatorStr=defaultGenerator):
        self.__primeInt = fromHex(primeStr)
        self.__generatorInt = fromHex(generatorStr)

        primeBytes = toByteString(self.__primeInt)
        generatorBytes = toByteString(self.__generatorInt)
        paddingLength = len(primeBytes) - len(generatorBytes)

        md = hashlib.sha1()
>       md.update(primeBytes)
E       TypeError: Unicode-objects must be encoded before hashing

pynuodb/crypt.py:116: TypeError

Please use common syntax for 2.7.x and 3.4.x

When rewriting or fixing this driver, please use syntax supported by more than one virtual of Python; using virtualenv to support testing assert the driver installs for both 3.4.3 and 2.7.6 without issue and tests satisfactorily.

Thank you.

Prepared statements result in no cache hits

When a prepared statement is executed more than once the statement should be cached and executed from cache. This functionality can be observed with the SQL client, but it's not working when the statements are executed via the python driver.

You can start the database like so:
'''
killall java nuodb
java -jar ~/nuodb/dist/jar/nuoagent.jar --broker --password bird &
~/nuodb/dist/bin/nuodbmgr --broker localhost --password bird --command "shutdown database test timeout 2m softTimeout 2m"
rm -rf /tmp/test
~/nuodb/dist/bin/nuodbmgr --broker localhost --password bird --command "start process sm database test host localhost:48004 archive /tmp/test initialize true"
~/nuodb/dist/bin/nuodbmgr --broker localhost --password bird --command "start process te database test host localhost:48004 options '--dba-user dba --dba-password dba'"
~/nuodb/dist/bin/nuodbmgr --broker localhost --password bird --command "show domain summary"
To connect to the SQL client and try something manually: ~/nuodb/dist/bin/nuosql test@localhost:48004 --user dba --password dba
'''

And use the following script to verify the functionality:
'''
import pynuodb
import time

def executeStatement(cursor, statement, prepared=None, fetch=False):
if prepared is not None:
print statement, ' ', prepared
if len(prepared) > 1:
cursor.executemany(statement, prepared)
else:
cursor.execute(statement, prepared)
else:
print statement
cursor.execute(statement)

if fetch == True:
    for row in cursor.fetchall():
        print row

options = {"schema": "test"}
connect_kw_args = {'database': "test", 'host': "localhost:48004", 'user': "dba", 'password': "dba", 'options': options}

connection = pynuodb.connect(**connect_kw_args)
cursor = connection.cursor()

executeStatement(cursor, 'autocommit on;')

tableName = 'SimpleTable'

executeStatement(cursor, 'DROP TABLE IF EXISTS %s;' % tableName)
executeStatement(cursor, 'CREATE TABLE %s (%s);' % (tableName, 'f1 INTEGER'))
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?),(?);', prepared=[(1, 1),(1, 1),(1, 1)])
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?),(?);', prepared=[(1, 1),(1, 1),(1, 1)])
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?),(?);', prepared=[(1, 1),(1, 1),(1, 1)])
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?),(?);', prepared=[(1, 1),(1, 1),(1, 1)])

executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?);', prepared=[1])
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?);', prepared=[1])
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?);', prepared=[1])
executeStatement(cursor, 'INSERT INTO SimpleTable VALUES (?);', prepared=[1])

check if the table is filled with data:

executeStatement(cursor, 'SELECT * from %s;' % tableName)
executeStatement(cursor, 'SELECT * from %s;' % tableName)
executeStatement(cursor, 'SELECT * from %s;' % tableName)
executeStatement(cursor, 'SELECT * from %s;' % tableName)

executeStatement(cursor, 'SELECT count(*) from %s;' % tableName, fetch=True)

print ''
print ''
executeStatement(cursor, 'select CACHEHITS, STATEMENT from system.localstatements where statement not like '%system%';', fetch=True)

cursor.close()
connection.close()
'''

The output at the moment (2018.09.27) shows:

'''
autocommit on;
DROP TABLE IF EXISTS SimpleTable;
CREATE TABLE SimpleTable (f1 INTEGER);
INSERT INTO SimpleTable VALUES (?),(?); [(1, 1), (1, 1), (1, 1)]
INSERT INTO SimpleTable VALUES (?),(?); [(1, 1), (1, 1), (1, 1)]
INSERT INTO SimpleTable VALUES (?),(?); [(1, 1), (1, 1), (1, 1)]
INSERT INTO SimpleTable VALUES (?),(?); [(1, 1), (1, 1), (1, 1)]
INSERT INTO SimpleTable VALUES (?); [1]
INSERT INTO SimpleTable VALUES (?); [1]
INSERT INTO SimpleTable VALUES (?); [1]
INSERT INTO SimpleTable VALUES (?); [1]
SELECT * from SimpleTable;
SELECT * from SimpleTable;
SELECT * from SimpleTable;
SELECT * from SimpleTable;

select CACHEHITS, STATEMENT from system.localstatements where statement not like '%system%';
(3, 'SELECT * from SimpleTable;')
(0, 'INSERT INTO SimpleTable VALUES (?),(?);')
(0, 'INSERT INTO SimpleTable VALUES (?);')
'''

The values for CACHEHITS for the prepared statements should be 3.

Incorrect test cases in large e notation test

We may want to revise the test cases in test_enotation_decimal_large. Values passed to the database are converted from e notation to decimal and passed back in decimal, despite this the assert statements are checking for the value in e notation, thus the test asserts.

From testing, NuoSQL responds the same way as the driver with returning a decimal value.

DataError: 'INVALID_UTF8: invalid UTF-8 code sequence' when inserting Decimal values with many significant digits

When inserting the value decimal.Decimal("31943874831932418390.01") into a numeric column, the database responds with the error 'INVALID_UTF8: invalid UTF-8 code sequence'

This could be an encoding error on the send side of the driver, or an error in the database itself.

Traceback (most recent call last):
  File "/home/travis/build/nuodb/nuodb-python/tests/nuodb_basic_test.py", line 160, in test_many_significant_digits
    self._test_decimal_fixture(decimal.Decimal("31943874831932418390.01"), 38, 12)
  File "/home/travis/build/nuodb/nuodb-python/tests/nuodb_basic_test.py", line 139, in _test_decimal_fixture
    cursor.execute("INSERT INTO t (x) VALUES (?)", (value,))
  File "/home/travis/build/nuodb/nuodb-python/pynuodb/cursor.py", line 116, in execute
    exec_result = self._executeprepared(operation, parameters)
  File "/home/travis/build/nuodb/nuodb-python/pynuodb/cursor.py", line 142, in _executeprepared
    return self.session.execute_prepared_statement(p_statement, parameters)
  File "/home/travis/build/nuodb/nuodb-python/pynuodb/encodedsession.py", line 217, in execute_prepared_statement
    self._exchangeMessages()
  File "/home/travis/build/nuodb/nuodb-python/pynuodb/encodedsession.py", line 796, in _exchangeMessages
    db_error_handler(error, self.getString())
  File "/home/travis/build/nuodb/nuodb-python/pynuodb/exception.py", line 86, in db_error_handler
    raise DataError(error_code_string + ': ' + error_string)
DataError: 'INVALID_UTF8: invalid UTF-8 code sequence'

Tests fail when some other managed database exists on the localhost.

Commonly developers will have several databases running when doing development. The test harness tries to go off and shutdown ALL databases; this should never be done.

tests/nuodb_entity_test.py:381: Exception
____________________________________________________ NuoDBEntityTest.test_shutdownDomain ____________________________________________________

self = <tests.nuodb_entity_test.NuoDBEntityTest testMethod=test_shutdownDomain>

    def setUp(self):
        self.host = BROKER_HOST + (':'+os.environ['NUODB_PORT'] if 'NUODB_PORT' in os.environ else '')

        domain = Domain(self.host, DOMAIN_USER, DOMAIN_PASSWORD)
>       self._cleanup(domain)

tests/nuodb_entity_test.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tests.nuodb_entity_test.NuoDBEntityTest testMethod=test_shutdownDomain>, domain = <pynuodb.entity.Domain instance at 0x10dd59dd0>

    def _cleanup(self, domain):
        if domain is not None:
            try:
                db_names = [db.name for db in domain.databases]
                for name in db_names:
                    db = domain.get_database(name)
                    db.shutdown()
                    i = 0
                    while len(db.processes) > 0 and i < 10:
                        time.sleep(1)
                        i += 1
                    if domain.get_database(name) is not None:
>                       raise Exception("Could not shutdown existing test database %s" % (name))
E                       Exception: Could not shutdown existing test database ref

Value params to query statements default to (0,)

It seems that if query params are not provided the query statement with a ? in it works when it should not. Take the Greg-Marsha-Jan sample on the README and pass in no second argument to the execute call -- it returns the full table, when it should have errorred.

import pynuodb

options = {"schema": "test"}
connect_kw_args = {'database': "test", 'host': "localhost", 'user': "dba", 'password': "dba", 'options': options}

connection = pynuodb.connect(**connect_kw_args)
cursor = connection.cursor()

stmt_drop = "DROP TABLE IF EXISTS names"
cursor.execute(stmt_drop)

stmt_create = """
CREATE TABLE names (
    id BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    name VARCHAR(30) DEFAULT '' NOT NULL,
    age INTEGER DEFAULT 0
)"""
cursor.execute(stmt_create)

names = (('Greg', 17,), ('Marsha', 16,), ('Jan', 14,))
stmt_insert = "INSERT INTO names (name, age) VALUES (?, ?)"
cursor.executemany(stmt_insert, names)

connection.commit()

age_limit = 15
stmt_select = "SELECT id, name FROM names where age > ? ORDER BY id"
# cursor.execute(stmt_select, (age_limit,)) # works, and correct

cursor.execute(stmt_select) # <<< WORKS BUT SHOULD HAVE FAILED <<<

print("Results:")
for row in cursor.fetchall():
    print("%d | %s" % (row[0], row[1]))

cursor.execute(stmt_drop)
cursor.close()
connection.close()

In Python2, passing a unicode object to execute() results in an exception

If you pass a unicode object, rather than a str object, to execute() (etc.) then you'll get a bizarre exception from Cryptography:

  File "nuodb-python/pynuodb/cursor.py", line 120, in execute
    exec_result = self._execute(operation)
  File "nuodb-python/pynuodb/cursor.py", line 153, in _execute
    return self.session.execute_statement(self._statement_cache.get_statement(), operation)
  File "nuodb-python/pynuodb/encodedsession.py", line 309, in execute_statement
    self._exchangeMessages()
  File "nuodb-python/pynuodb/encodedsession.py", line 1073, in _exchangeMessages
    self.send(self.__output)
  File "nuodb-python/pynuodb/session.py", line 351, in send
    message = self.__cipherOut.transform(message)
  File "nuodb-python/pynuodb/crypt.py", line 321, in transform
    transformed = self.cipher.update(data)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 149, in update
    return self._ctx.update(data)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 124, in update
    n = self.update_into(data, buf)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 140, in update_into
    self._backend._ffi.from_buffer(data), len(data)
TypeError: from_buffer() cannot return the address of a unicode object

Latest py.pi release has .REL extension

To declare a dependency I have to add -REL rather than just use the version number:

-pynuodb>=2.3
+pynuodb>=2.3-REL

This regards the files posted on py.pi:
pynuodb-2.3-REL.tar.gz (md5)
When the file name ought to have been:
pynuodb-2.3.tar.gz (md5)

pynuodb "select *" on system table fails with 'Not a UUID' on numeric(20)

from pynuodb import connect
db = connect('test', 'localhost', 'dba', 'dba')
c = db.cursor()
c.execute('select * from system.connections')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pynuodb/cursor.py", line 142, in execute
    row[i] = self.session.getValue()
  File "/Library/Python/2.7/site-packages/pynuodb/encodedsession.py", line 443, in getValue
    return self.getUUID()
  File "/Library/Python/2.7/site-packages/pynuodb/encodedsession.py", line 425, in getUUID
    raise DataError('Not a UUID')
pynuodb.exception.DataError: 'Not a UUID'

To work around this, skip the "EXECID" column.

SQL> show system.connections;

    Tables named CONNECTIONS

    Found table CONNECTIONS in schema SYSTEM

        Fields:
            SQLSTRING string
            COUNT integer
            RUNTIME bigint
            USER string
            SCHEMA string
            NUMPARAM integer
            PARAMS string
            CONNID integer
            OPEN integer
            HANDLE integer
            NODEID integer
            EXECID numeric(20)

Modifying con.auto_commit causes hang

This code:

con = pynuodb.connect("test", "localhost", "dba", "goalie", schema="hockey");
con.auto_commit = True;

causes the driver to hang

strace shows that pyton is hung waiting on recvfrom() from the server. The server however seems to also be waiting for a message.

Limitations of year in datetime and date types

In the current implementation of the python driver you are unable to insert a date or datetime that has a year prior to 1902 without getting an error. Additionally if a year is already present in the database prior to 1884 then these values may be incorrect when retrieved by the python driver.

[Question] Is there a way to get column names along with a query?

When I execute a SELECT statement, I do get the rows back like I expected, but I was also wanting to see the names of the columns in the response.

Here is my code I'm testing with

import pynuodb
options = {'schema': "MY_SCHEMA"}
connect_kw_args = {'database': "MY_DB", 'host': "MY_HOST", 'user': "MY_USER", 'password': "MY_PW", 'options': options}
connection = pynuodb.connect(**connect_kw_args)
cursor = connection.cursor()
stmt_select = "SELECT * FROM Money LIMIT 2"
cursor.execute(stmt_select)
print("Results:")
for row in cursor.fetchall():
    print(row)
cursor.close()
connection.close()

OUTPUT:

Results:
(1, 'USD', '155.48')
(2, 'USD', '149.99')

DESIRED OUTPUT: (something like this)

Results:
('Id', 'Denomination', 'Value')
(1, 'USD', '155.48')
(2, 'USD', '149.99')

Is there any way to get something like that? Thanks for the help.

Add isolation level support

Currently only the default isolation level is supported. Need to add a parameter to pass in to specify the isolation level upon connection to the database.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.