Hi Mike,
Thank you for your help.
with mysqlclient everything works OK.
just in case below is error i had with mysqlclient connector.
Traceback (most recent call last):
File "/var/app/admin.feeds.az/scripts/test.py", line 18, in <module>
t = session.query(Test.hash).filter(Test.id == 380059).all()
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py",
line 2925, in all
return list(self)
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/orm/loading.py",
line 105, in instances
util.raise_from_cause(err)
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py",
line 296, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py",
line 277, in reraise
raise value
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/orm/loading.py",
line 89, in instances
for row in fetch
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/orm/loading.py",
line 89, in <listcomp>
for row in fetch
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/orm/loading.py",
line 88, in <listcomp>
keyed_tuple([proc(row) for proc in process])
File "/var/venv/lib/python3.6/site-packages/sqlalchemy/sql/sqltypes.py",
line 936, in process
value = bytes(value)
TypeError: string argument without an encoding
On Friday, February 1, 2019 at 2:12:55 AM UTC+4, Mike Bayer wrote:
>
> Please use mysqlclient or pymysql, don't use mysqlclient connector. Also
> please define "crash". complete stack trace please ?
>
> On Thu, Jan 31, 2019, 4:44 PM Teymur Agayev <[email protected]
> <javascript:> wrote:
>
>> Hi All,
>>
>> After upgrade on my VPS the one of the scripts started periodical crash.
>> After debugging I found that the problem in the filed that stores hashes.
>> for some reason the script started crash on some particular hash values.
>> Below is the test script and attached is the database dump.
>>
>> when ID is 380059 script crashs, other ids, 380058 or 380060 for example,
>> work ok.
>>
>> from sqlalchemy import MetaData, Column, Integer, LargeBinary
>> from sqlalchemy.ext.declarative import declarative_base
>> from sqlalchemy import create_engine
>> from sqlalchemy.orm import sessionmaker
>>
>> metadata = MetaData()
>> Base = declarative_base(metadata=metadata)
>>
>> class Test(Base):
>> __tablename__ = "test"
>> id = Column(Integer, primary_key=True)
>> hash = Column(LargeBinary(16))
>>
>> engine = create_engine('mysql+mysqlconnector://root:q2w3e4r5@localhost/
>> ru.feeds.az')
>> Session = sessionmaker(bind=engine)
>> session = Session()
>>
>> t = session.query(Test.hash).filter(Test.id == 380059).all()
>> print(t)
>>
>>
>> On this system doesn't work.
>> Python 3.6, SQLAlchemy 1.2.17
>>
>> On this systems works fine.
>> Python 3.5, SQLAlchemy 1.1.14
>>
>> Is it a bug or I just doing something wrong.
>>
>> Thanks,
>> Teymur
>>
>> --
>> SQLAlchemy -
>> The Python SQL Toolkit and Object Relational Mapper
>>
>> http://www.sqlalchemy.org/
>>
>> To post example code, please provide an MCVE: Minimal, Complete, and
>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
>> description.
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.