Posts

Showing posts from April 3, 2019

Connect to multiple data sources at once using Flask-GraphiQL

Image
0 I'm building a GraphQL API that connects to two different databases. I'm trying to create a GraphQL interface using Flask-GraphQL but it appears I can only bind a single SQLAlchemy session to the app at once via the context variable: from flask import Flask from flask_graphql import GraphQLView from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session from schema import schema # connect to database sources engine1 = create_engine('sqlite:///db1.sqlite3') engine2 = create_engine('sqlite:///db2.sqlite3') session1 = scoped_session(sessionmaker(bind=engine1)) session2 = scoped_session(sessionmaker(bind=engine2)) # create app and add GraphiQL route app = Flask(__name__) app.add_url_rule('/graphql', view_func=GraphQLView.as_view( ...

Calculating entropy change: reversible vs irreversible process

Image
4 $begingroup$ Since the change in internal energy and enthalpy, which are equal to the heats for a constant-volume and constant-pressure process, respectively, are state functions, the heats for a reversible v.s. irreversible process should be equal. Thus, the entropy change of the surroundings which equals the quotient of the heat and temperature are equal for reversible v.s. irreversible processes. As Engel's Physical Chemistry states it: Because H and U are state functions, the amount of heat entering the surroundings is independent of the path; q is the same whether the transfer occurs reversibly or irreversibly. However, when the book proceeds to evaluating the change in entropy for the surroundings for a reversible vs irreersible process, the q used for evaluating the change in entropy of surro...