partsdb

electronic parts inventory
git clone https://git.e1e0.net/partsdb.git
Log | Files | Refs

commit 2edab6b1d1eb048745a8cece4100eb781f3fa1b4
parent 91de564a864e083dd34564620cf1b808b5e1ff11
Author: Paco Esteban <paco@e1e0.net>
Date:   Mon, 15 Mar 2021 15:18:34 +0100

remove crappy migration script

Diffstat:
M.gitignore | 1+
Dmigration.py | 52----------------------------------------------------
2 files changed, 1 insertion(+), 52 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ __pycache__ env parts.db +migration.py diff --git a/migration.py b/migration.py @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# vim:fenc=utf-8 - -import pymysql -import pymysql.cursors - - -OUT_QUERY = """ - select p.id,p.name,p.description,p.comment,p.stockLevel,p.status,f.name as footprint - from (Part as p, Footprint as f) - inner join Footprint - on p.footprint_id = f.id - group by p.id limit 10; -""" -DOCS_QUERY = "select filename, mimetype, extension from PartAttachment where part_id = %s" -CAT_MATCH = { - 13: [10]+list(range(14, 19+1)), - 1: list(range(20,25+1))+[55], - 2: [26]+list(range(29,35+1)), - 4: [27], - 9: [28], - 3: [36], - 8: list(range(37,40+1)), - 15: [41], - 16: [42], - 17: [44], - 5: list(range(45,48+1)), - 14: [54], - 18: [53], - 19: [43], - 12: [50], - 20: [49], - 21: [51], - 7: [8], - 22: [58] -} - -db = pymysql.connect(host="localhost", user="pk", password="pk_pwd", database="pk", - cursorclass=pymysql.cursors.DictCursor) -cur = db.cursor() - -cur.execute(OUT_QUERY) - -for row in cur.fetchall(): - cur.execute(DOCS_QUERY, (row['id'],)) - # foo = [x for (x) in CAT_MATCH.items() if 14 in v] - docs = cur.fetchone() - if docs: - pass - -db.close()