Comments (4)
I got same thing using Flask with SQLAlchemy before.
http://stackoverflow.com/questions/16341911/sqlalchemy-error-mysql-server-has-gone-away
http://stackoverflow.com/questions/6471549/avoiding-mysql-server-has-gone-away-on-infrequently-used-python-flask-server
from grab.
Hi, @lorien
There are my db.py, SQLAlchemy template for all my projects. Parsers, Flask sites etc.
«mysql has gone away» is solved.
I drop this file into some project, example:
..
./models/
./app.py
./db.py
and init db in app:
from db import db_session, init_db
SQLALCHEMY_DATABASE_URI = "mysql+mysqldb://%s:%s@%s/%s?charset=utf8" % (db_user, db_pass, db_host, db_name)
init_db(SQLALCHEMY_DATABASE_URI)
...
...
db_session.add(Model)
db_session.commit()
And Model:
from sqlalchemy import (
Column,
Integer,
)
from db import Base
class User(Base):
"""User Model"""
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
from grab.
«Patch» action log:
2014-10-13 17:47:30,027 INFO sqlalchemy.pool.QueuePool Connection <_mysql.connection open to '127.0.0.1' at 7ffcb48eca20> exceeded timeout; recycling
2014-10-14 21:02:31,507 INFO sqlalchemy.pool.QueuePool Connection <_mysql.connection open to '127.0.0.1' at 7ffcb4002220> exceeded timeout; recycling
from grab.
Пожалуй, закрою этот тикет, так как я его сам открывал, а фунциональность эта мне уже сто лет как не нужна.
from grab.
Related Issues (20)
- Remove multicurl transport HOT 1
- empty request headers and body in *.log files when using log_dir option
- spider: impossible to setup grab transport HOT 2
- Can i use grab with async? HOT 1
- Segmentation fault 11 HOT 2
- import error in windows HOT 2
- Typo in documentation HOT 1
- Support ubuntu 19.04 / python3.7 and python3.8 HOT 3
- How to filter duplicate urls HOT 2
- Deprecation warning for defusedxml.lxml HOT 1
- Fix simple typo: shuld -> should
- In Windows XP HOT 9
- Не устанавливается в Линукс HOT 7
- похоже метод в Thread isAlive() был переименован в is_alive() в Python 3.9.0 HOT 2
- On the github page the link to http://grablib.org/ seems broken. HOT 1
- Why not have any new releases on PyPi ? HOT 4
- Failed pycurl/resolve/cookies test
- Fix tests for python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats HOT 2
- Wrong Thread method for Python 3.9.0+ HOT 1
- Fix grammar/spelling errors in README.md
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grab.