Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Anum Sheraz SQLAlchemy question
Created
5 years ago
Diff never expires
Clear
Export
Share
Explain
9 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
33 lines
Copy
12 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
36 lines
Copy
import os
import os
from flask import Flask
from flask import Flask
from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy
from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy
Copy
Copied
Copy
Copied
# Coordinate DevConfig with SQLAlchemy and Flask-SQLAlchemy (don't repeat yourself!)
class DevConfig():
SQLALCHEMY_POOL_RECYCLE = 40
SQLALCHEMY_POOL_TIMEOUT = 10
SQLALCHEMY_PRE_PING = True
SQLALCHEMY_ENGINE_OPTIONS = {'pool_recycle': SQLALCHEMY_POOL_RECYCLE, 'pool_timeout': SQLALCHEMY_POOL_TIMEOUT, 'pool_pre_ping': SQLALCHEMY_PRE_PING}
Text moved from lines 18-21
DEBUG = True
# SERVER_NAME = '127.0.0.1:5000'
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV')
SQLALCHEMY_TRACK_MODIFICATIONS = False
class SQLAlchemy(_BaseSQLAlchemy):
class SQLAlchemy(_BaseSQLAlchemy):
def apply_pool_defaults(self, app, options):
def apply_pool_defaults(self, app, options):
super(SQLAlchemy, self).apply_pool_defaults(app, options)
super(SQLAlchemy, self).apply_pool_defaults(app, options)
Copy
Copied
Copy
Copied
options["pool_pre_ping"] =
True
options["pool_pre_ping"] =
DevConfig.SQLALCHEMY_PRE_PING
# options["pool_recycle"] = 30
# options["pool_recycle"] = 30
# options["pool_timeout"] = 35
# options["pool_timeout"] = 35
db = SQLAlchemy()
db = SQLAlchemy()
Copy
Copied
Copy
Copied
class DevConfig():
SQLALCHEMY_ENGINE_OPTIONS = {'pool_recycle': 280, 'pool_timeout': 100, 'pool_pre_ping': True} # These configs doesn't get applied in engine configs :/
Text moved to lines 12-15
DEBUG = True
# SERVER_NAME = '127.0.0.1:5000'
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV')
SQLALCHEMY_TRACK_MODIFICATIONS = False
config = dict(
config = dict(
dev=DevConfig,
dev=DevConfig,
)
)
app = Flask(__name__, instance_relative_config=True)
app = Flask(__name__, instance_relative_config=True)
app.config.from_object(config['dev'])
app.config.from_object(config['dev'])
# INIT DATABASE
# INIT DATABASE
db.init_app(app)
db.init_app(app)
with app.app_context():
with app.app_context():
db.create_all()
db.create_all()
Saved diffs
Original text
Open file
import os from flask import Flask from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy class SQLAlchemy(_BaseSQLAlchemy): def apply_pool_defaults(self, app, options): super(SQLAlchemy, self).apply_pool_defaults(app, options) options["pool_pre_ping"] = True # options["pool_recycle"] = 30 # options["pool_timeout"] = 35 db = SQLAlchemy() class DevConfig(): SQLALCHEMY_ENGINE_OPTIONS = {'pool_recycle': 280, 'pool_timeout': 100, 'pool_pre_ping': True} # These configs doesn't get applied in engine configs :/ DEBUG = True # SERVER_NAME = '127.0.0.1:5000' SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV') SQLALCHEMY_TRACK_MODIFICATIONS = False config = dict( dev=DevConfig, ) app = Flask(__name__, instance_relative_config=True) app.config.from_object(config['dev']) # INIT DATABASE db.init_app(app) with app.app_context(): db.create_all()
Changed text
Open file
import os from flask import Flask from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy # Coordinate DevConfig with SQLAlchemy and Flask-SQLAlchemy (don't repeat yourself!) class DevConfig(): SQLALCHEMY_POOL_RECYCLE = 40 SQLALCHEMY_POOL_TIMEOUT = 10 SQLALCHEMY_PRE_PING = True SQLALCHEMY_ENGINE_OPTIONS = {'pool_recycle': SQLALCHEMY_POOL_RECYCLE, 'pool_timeout': SQLALCHEMY_POOL_TIMEOUT, 'pool_pre_ping': SQLALCHEMY_PRE_PING} DEBUG = True # SERVER_NAME = '127.0.0.1:5000' SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI_DEV') SQLALCHEMY_TRACK_MODIFICATIONS = False class SQLAlchemy(_BaseSQLAlchemy): def apply_pool_defaults(self, app, options): super(SQLAlchemy, self).apply_pool_defaults(app, options) options["pool_pre_ping"] = DevConfig.SQLALCHEMY_PRE_PING # options["pool_recycle"] = 30 # options["pool_timeout"] = 35 db = SQLAlchemy() config = dict( dev=DevConfig, ) app = Flask(__name__, instance_relative_config=True) app.config.from_object(config['dev']) # INIT DATABASE db.init_app(app) with app.app_context(): db.create_all()
Find difference