Skip to content

Commit

Permalink
Update menus.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
adriens authored May 29, 2023
1 parent 153d616 commit 80657c4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions menus.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

import os
import duckdb
con = duckdb.connect(database=':memory:')

Expand All @@ -11,7 +12,8 @@ from auptitcafe.menus import Menus
menu_instance = Menus()

# Dump menus as a csv file
menus = 'menus.csv'
os.system('mkdir -p data')
menus = 'data/menus.csv'
menu_instance.to_csv(menus)

con.execute("""create or replace table menus(
Expand All @@ -30,12 +32,10 @@ con.execute("""insert into menus
category,
recette,
image_url
from 'menus.csv';""")

import os
os.system('mkdir -p data')
from 'data/menus.csv';""")
os.system('rm data/menus.csv')

con.execute("""COPY menus TO 'data/current_menus.csv';""")
con.execute("""COPY menus TO 'data/current_menus_headers.csv' (HEADER, DELIMITER ',');""")

os.system('cat data/current_menus.csv >> data/menus.csv')
os.system('cat data/current_menus.csv >> data/menus_hist.csv')

0 comments on commit 80657c4

Please sign in to comment.