import psycopg2
def is_duplicated_data(artist,album,track):
# 데이터베이스 연결 정보
dbname = "postgres"
user = "postgres"
password = "12345678"
host = "database-1.coea55uwjt5p.ap-northeast-1.rds.amazonaws.com"
port = "5432"
# 데이터베이스 연결
conn = psycopg2.connect(
dbname=dbname,
user=user,
password=password,
host=host,
port=port
)
# 커서 생성
cursor = conn.cursor()
query = f"""SELECT *
FROM route
WHERE artist_name = '{artist}'
AND album_name = '{album}'
AND track_name = '{track}';
"""python
cursor.execute(query)
result = cursor.fetchall()
# 커밋
conn.commit()
# 연결 종료
conn.close()
if result:
return True
else:
return False
Issue: :white_check_mark: 중복성 체크!
Description
is_duplicated_data(artist, album, track)
To-do
ETC
추가적인 요청은 댓 달아주세요
CODE