-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from studio-recoding/dev
feat: case2 카테고리 기능 추가
- Loading branch information
Showing
9 changed files
with
238 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
import pymysql | ||
from pymysql.cursors import DictCursor | ||
from dotenv import load_dotenv | ||
|
||
# .env 파일에서 환경 변수 로드 | ||
load_dotenv() | ||
|
||
def get_rds_connection(): | ||
return pymysql.connect( | ||
host=os.getenv('RDS_HOST'), | ||
user=os.getenv('RDS_USER'), | ||
password=os.getenv('RDS_PASSWORD'), | ||
database=os.getenv('RDS_DATABASE'), | ||
cursorclass=DictCursor | ||
) | ||
|
||
def fetch_category_classification_data(member_id): | ||
connection = get_rds_connection() | ||
try: | ||
with connection.cursor() as cursor: | ||
sql = """ | ||
SELECT c.* | ||
FROM category c | ||
WHERE c.member_id = %s | ||
""" | ||
cursor.execute(sql, (member_id,)) | ||
result = cursor.fetchall() | ||
return result | ||
finally: | ||
connection.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.