From 2374181fd91d24702d427f73085ae964f54ae26d Mon Sep 17 00:00:00 2001 From: Zach Halpern Date: Sun, 21 Apr 2019 23:59:37 -0400 Subject: [PATCH] Add new missing fields from recent updates Signed-off-by: Zach Halpern --- mtgsqlive/json2sql.py | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/mtgsqlive/json2sql.py b/mtgsqlive/json2sql.py index c7a01c2..3c35707 100644 --- a/mtgsqlive/json2sql.py +++ b/mtgsqlive/json2sql.py @@ -74,15 +74,28 @@ def build_sql_schema(sql_connection: sqlite3.Connection) -> None: "boosterV3 TEXT," "code TEXT," "codeV3 TEXT," + "isFoilOnly INTEGER NOT NULL DEFAULT 0," "isOnlineOnly INTEGER NOT NULL DEFAULT 0," + "keyruneCode TEXT," + "mcmName TEXT," + "mcmId INTEGER," "meta TEXT," "mtgoCode TEXT," "name TEXT," + "parentCode TEXT," "releaseDate TEXT," - "totalSetSize INTEGER," - "type TEXT," "tcgplayerGroupId INTEGER," - "isFoilOnly INTEGER NOT NULL DEFAULT 0" + "totalSetSize INTEGER," + "type TEXT" + ")" + ) + + # Translations for set names + cursor.execute( + "CREATE TABLE `set_translations` (" + "language TEXT," + "translation TEXT," + "setCode TEXT" ")" ) @@ -125,16 +138,18 @@ def build_sql_schema(sql_connection: sqlite3.Connection) -> None: "hasFoil INTEGER NOT NULL DEFAULT 0," "hasNonFoil INTEGER NOT NULL DEFAULT 0," "isAlternative INTEGER NOT NULL DEFAULT 0," - "isFoilOnly INTEGER NOT NULL DEFAULT 0," "isOnlineOnly INTEGER NOT NULL DEFAULT 0," "isOversized INTEGER NOT NULL DEFAULT 0," "isReserved INTEGER NOT NULL DEFAULT 0," - "starter INTEGER NOT NULL DEFAULT 0," + "isStarter INTEGER NOT NULL DEFAULT 0," "isTimeshifted INTEGER NOT NULL DEFAULT 0," "layout TEXT," "life TEXT," "loyalty TEXT," "manaCost TEXT," + "mcmName TEXT DEFAULT NULL," + "mcmId INTEGER DEFAULT 0," + "mcmMetaId INTEGER DEFAULT 0," "multiverseId INTEGER," "name TEXT," "names TEXT," @@ -143,8 +158,11 @@ def build_sql_schema(sql_connection: sqlite3.Connection) -> None: "originalType TEXT," "printings TEXT," "power TEXT," + "purchaseUrls TEXT," "rarity TEXT," "scryfallId TEXT," + "scryfallOracleId TEXT," + "scryfallIllustrationId TEXT," "setCode TEXT," "side TEXT," "subtypes TEXT," @@ -156,6 +174,7 @@ def build_sql_schema(sql_connection: sqlite3.Connection) -> None: "type TEXT," "types TEXT," "uuid TEXT(36) PRIMARY KEY," + "uuidV421 TEXT," "variations TEXT," "watermark TEXT" ")" @@ -170,18 +189,22 @@ def build_sql_schema(sql_connection: sqlite3.Connection) -> None: "colorIndicator TEXT," "colors TEXT," "isOnlineOnly INTEGER NOT NULL DEFAULT 0," + "layout TEXT," "loyalty TEXT," "name TEXT," "number TEXT," "power TEXT," "reverseRelated TEXT," "scryfallId TEXT," + "scryfallOracleId TEXT," + "scryfallIllustrationId TEXT," "setCode TEXT," "side TEXT," "text TEXT," "toughness TEXT," "type TEXT," "uuid TEXT," + "uuidV421 TEXT," "watermark TEXT" ")" ) @@ -249,7 +272,7 @@ def handle_set_row_insertion(set_data: Dict[str, Any]) -> Dict[str, Any]: :param set_data: Data to process :return: Dictionary ready for insertion """ - set_skip_keys = ["cards", "tokens"] + set_skip_keys = ["cards", "tokens", "translations"] set_insert_values = {} for key, value in set_data.items():