직접 쿼리 작성하고 싶을 때
https://stackoverflow.com/questions/17972020/how-to-execute-raw-sql-in-flask-sqlalchemy-app
How to execute raw SQL in Flask-SQLAlchemy app
How do you execute raw SQL in SQLAlchemy? I have a python web app that runs on flask and interfaces to the database through SQLAlchemy. I need a way to run the raw SQL. The query involves multiple
stackoverflow.com
INSERT IGNORE
def insert_act(temp, table_name):
database = MySQLdb.connect (host="localhost", user="root", password="******", db="data_schema")
cursor = database.cursor()
cursor.execute("SELECT ID FROM %s" % table_name)
if len(cursor.fetchall()) != len(temp):
print(table_name+"들어옴")
for i in temp:
cursor.execute(query1, [i])
cursor.close()
database.commit()
SQLAlchemy(join 사용법)
flask many to many join as done by prefetch_related from django
I have following Group and Contact model in flask with Sql Alchemy ORM group_contact = db.Table( 'group_contact', db.Column('group_id', db.Integer, db.ForeignKey( 'group.id')), ...
stackoverflow.com
https://blog.hongminhee.org/2013/10/30/65522658529/
SQLAlchemy에서 쿼리할 때 조인을 직접 명시해야 하는 경우는 별로 없다
오랜만에 특정 라이브러리의 세부사항에 대해 얘기해본다. …
blog.hongminhee.org
'DB' 카테고리의 다른 글
[ELK Stack] Elasicsearch, Logstash, Kibana, Beats 알아보기 (0) | 2020.06.03 |
---|---|
[SQLAlchemy] 참조키 연결 (0) | 2020.05.12 |