Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql_batch 폴더 추가 #15

Merged
merged 6 commits into from
May 20, 2024
Merged

mysql_batch 폴더 추가 #15

merged 6 commits into from
May 20, 2024

Conversation

one0955
Copy link
Contributor

@one0955 one0955 commented May 15, 2024

기존 프로젝트 그대로 놔두고 mysql_batch 폴더만 추가하였습니다

Copy link
Member

@sinkyoungdeok sinkyoungdeok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생많으셨습니다! csv가 조금씩 바뀌었어서, 한번씩 다시 보시고 반영해주시면 좋을 것 같아요 👍 👍

@@ -0,0 +1 @@
.DS_STORE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


create_table_restaurants = """
CREATE TABLE `restaurants` (
`restaurant_id` BIGINT NOT NULL AUTO_INCREMENT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restaurant_id -> id 로 변경 부탁드립니다.
table의 pk는 모두 id로 통일해주세요~

Comment on lines 19 to 20
`review_count` BIGINT NOT NULL DEFAULT 0,
`like_count` BIGINT NOT NULL DEFAULT 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사소하지만 BIGINT 살짝 과한것 같습니다 ㅎㅎ INT로 해도 충분하겠습니다.

`review_count` BIGINT NOT NULL DEFAULT 0,
`like_count` BIGINT NOT NULL DEFAULT 0,
`address` VARCHAR(256),
`contact_num` VARCHAR(32),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contact_number 로 변경 부탁드립니다.

`contact_num` VARCHAR(32),
`rating_avg` DOUBLE,
`representative_image_url` TEXT,
`kingo_pass` TINYINT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kingo_pass -> discount_content 로 변경해주세요~ (varchar(100)

`representative_image_url` TEXT,
`kingo_pass` TINYINT,
`view_count` BIGINT DEFAULT 0,
PRIMARY KEY (`restaurant_id`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> id

Comment on lines 31 to 38
create_table_restaurant_likes ="""
CREATE TABLE `restaurant_likes` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`restaurant_id` BIGINT NOT NULL,
`user_name` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 좋아요 테이블을 만들고 삭제안해도 되지 않을까요?

`contact_num`,
`rating_avg`,
`representative_image_url`,
`kingo_pass`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

csv에 discount_content 추가되었으니 반영 부탁드립니다.

def insert_into_restaurants(cursor, restaurant):

insert_query = """
INSERT INTO `restaurants` (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

menus 도 csv 추가되었으니 반영 부탁드립니다~

@github-actions github-actions bot requested a review from sinkyoungdeok May 18, 2024 14:01
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 폴더도 gitignore로 추가하고 제거해주세요~

CREATE TABLE IF NOT EXISTS `menus` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`restaurant_id` BIGINT NOT NULL,
`menu_name` VARCHAR(255) NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name이면 충분할 것 같아요~

@github-actions github-actions bot requested a review from sinkyoungdeok May 20, 2024 02:35
Copy link
Member

@sinkyoungdeok sinkyoungdeok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파일 2개만 지우고 머지하셔도 될 것 같습니다
고생하셨습니다! 👍

csv_dict = csv.DictReader(file)
for row in csv_dict:
print(row)
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break? 테스트하다 남은걸까요?

Comment on lines +44 to +54
def insert_into_categories(cursor, restaurant):

insert_query = """
INSERT IGNORE INTO categories (restaurant_id, name)
VALUES (%s, %s);
"""

cursor.execute(insert_query, (
restaurant['id'],
restaurant['custom_category']
))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set으로 한번 category name을 걸러내고 insert 하는게 더 낫긴할텐데
몇건안되니까 지금도 괜찮긴합니다

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 파일 필요없어보이는데 지워주세요~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이것도 지워주세요~

@sinkyoungdeok sinkyoungdeok merged commit 1cc8859 into main May 20, 2024
1 check passed
@sinkyoungdeok sinkyoungdeok deleted the KAN-65 branch May 20, 2024 14:11
@github-actions github-actions bot requested a review from sinkyoungdeok May 20, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants