직접 쿼리 작성하고 싶을 때
https://stackoverflow.com/questions/17972020/how-to-execute-raw-sql-in-flask-sqlalchemy-app
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 사용법)
https://blog.hongminhee.org/2013/10/30/65522658529/
'DB' 카테고리의 다른 글
[ELK Stack] Elasicsearch, Logstash, Kibana, Beats 알아보기 (0) | 2020.06.03 |
---|---|
[SQLAlchemy] 참조키 연결 (0) | 2020.05.12 |