瀏覽代碼

Fix ingest_csv.py indentation and setup_db.py robustness

lanfr144 3 周之前
父節點
當前提交
ea5ebd7989
共有 3 個文件被更改,包括 43 次插入5 次删除
  1. 1 0
      ingest_csv.py
  2. 2 5
      setup_db.py
  3. 40 0
      taiga_sprint4_deploy.py

+ 1 - 0
ingest_csv.py

@@ -38,6 +38,7 @@ def ingest_file(filename, engine):
             if 'code' in chunk.columns:
                 df = chunk.drop_duplicates(subset=['code'])
             else:
+                df = chunk
             # Eliminate completely empty columns to save storage
             df.dropna(axis=1, how='all', inplace=True)
             

+ 2 - 5
setup_db.py

@@ -139,11 +139,8 @@ def run_db_setup():
     cursor.execute("GRANT SELECT, INSERT, UPDATE, DELETE ON food_db.plates TO 'db_app_auth'@'%';")
     cursor.execute("GRANT SELECT, INSERT, UPDATE, DELETE ON food_db.plate_items TO 'db_app_auth'@'%';")
     
-    # Give the app read privileges on the partitioned products tables
-    cursor.execute("GRANT SELECT ON food_db.products_1 TO 'db_app_auth'@'%';")
-    cursor.execute("GRANT SELECT ON food_db.products_2 TO 'db_app_auth'@'%';")
-    cursor.execute("GRANT SELECT ON food_db.products_3 TO 'db_app_auth'@'%';")
-    cursor.execute("GRANT SELECT ON food_db.products_4 TO 'db_app_auth'@'%';")
+    # Give the app read privileges on the whole database (including the products view when created)
+    cursor.execute("GRANT SELECT ON food_db.* TO 'db_app_auth'@'%';")
     
     cursor.execute("GRANT SELECT ON food_db.* TO 'db_reader'@'%';")
     cursor.execute("GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, INDEX, CREATE VIEW ON food_db.* TO 'db_loader'@'%';")

+ 40 - 0
taiga_sprint4_deploy.py

@@ -0,0 +1,40 @@
+import requests, urllib3
+urllib3.disable_warnings()
+
+auth = requests.post(
+    'https://192.168.130.161/taiga/api/v1/auth', 
+    json={'type': 'normal', 'username': 'lanfr1904@outlook.com', 'password': 'BTSai123'}, 
+    verify=False
+).json()
+headers = {'Authorization': f'Bearer {auth["auth_token"]}'}
+proj_id = 21
+sprint4_id = 71
+
+us_list = requests.get(f'https://192.168.130.161/taiga/api/v1/userstories?project={proj_id}', headers=headers, verify=False).json()
+
+tasks = [
+    "Refactor Cryptography Bug - Replace dynamic salting loop with bcrypt.checkpw",
+    "Implement Horizontal Table Partitioning to bypass MySQL 65KB InnoDB limit",
+    "Construct dynamic UI multiselect for mapping 200 CSV columns seamlessly",
+    "Bind Pandas dataframes tightly to Memory logic preventing UI crashes",
+    "Overwrite LLM system prompts strictly for native Markdown gram output",
+    "Configure native mail throttle limits to block .pt.lu bounce delays"
+]
+
+target_us = None
+for us in us_list:
+    if "Sprint 4" in us['subject'] or us['milestone'] is None:
+        target_us = us
+        # Patch US to Sprint 4 milestone
+        res = requests.patch(f"https://192.168.130.161/taiga/api/v1/userstories/{us['id']}", 
+            headers=headers, 
+            json={"milestone": sprint4_id, "version": us['version']}, 
+            verify=False)
+        print(f"Mapped US {us['id']} ({us['subject']}) into Sprint 4 Milestone!")
+        
+        for t in tasks:
+            requests.post('https://192.168.130.161/taiga/api/v1/tasks', headers=headers, json={"project": proj_id, "user_story": us['id'], "subject": t}, verify=False)
+        print(f"Successfully appended granular deployment tasks into US: {us['id']}")
+        
+if not target_us:
+    print("No open unassigned User Stories found to append Sprint 4 data.")