DatabaseException
Failed to execute `CREATE TABLE IF NOT EXISTS `_new_cache_card` (`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT , `name` VARCHAR(190) NOT NULL , `mana_cost` VARCHAR(190) , `cmc` REAL , `power` VARCHAR(190) , `toughness` VARCHAR(190) , `loyalty` VARCHAR(190) , `type_line` VARCHAR(190) NOT NULL , `oracle_text` LONGTEXT NOT NULL , `hand` INTEGER , `life` INTEGER , `position` VARCHAR(190) NOT NULL , `card_id` INTEGER NOT NULL , `layout` VARCHAR(190) NOT NULL , `legalities` LONGTEXT , `names` LONGTEXT , `pd_legal` BOOLEAN , `bugs` LONGTEXT , FOREIGN KEY (`card_id`) REFERENCES `card`(`id`)) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
`u`.`id` AS `id`,
CASE
WHEN layout = 'transform' OR layout = 'flip' OR layout = 'meld' OR layout = 'adventure' THEN
GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN face_name ELSE '' END SEPARATOR '')
ELSE
GROUP_CONCAT(face_name SEPARATOR ' // ' )
END
AS name,
CASE
WHEN layout = 'flip' THEN
GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN mana_cost ELSE '' END SEPARATOR '')
ELSE
GROUP_CONCAT(`u`.`mana_cost` SEPARATOR '|')
END
AS mana_cost,
CASE
WHEN layout = 'split' THEN
SUM(CASE WHEN `u`.cmc IS NOT NULL THEN `u`.cmc ELSE 0 END)
ELSE
SUM(CASE WHEN `u`.position = 1 THEN `u`.cmc ELSE 0 END)
END
AS cmc, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`power` ELSE '' END SEPARATOR '') AS `power`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`toughness` ELSE '' END SEPARATOR '') AS `toughness`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`loyalty` ELSE '' END SEPARATOR '') AS `loyalty`,
GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN type_line ELSE '' END SEPARATOR '')
AS type_line, GROUP_CONCAT(`u`.`oracle_text` SEPARATOR '
-----
') AS `oracle_text`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`hand` ELSE 0 END) AS `hand`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`life` ELSE 0 END) AS `life`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`position` ELSE '' END SEPARATOR '') AS `position`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`card_id` ELSE 0 END) AS `card_id`, `u`.`layout` AS `layout`, legalities, GROUP_CONCAT(face_name SEPARATOR '|') AS names, `u`.`pd_legal` AS `pd_legal`, bugs
FROM (
SELECT c.id, c.layout, f.mana_cost, f.cmc, f.power, f.toughness, f.loyalty, f.type_line, f.oracle_text, f.hand, f.life, f.position, f.card_id, f.name AS face_name,
pd_legal,
legalities
FROM
card AS c
INNER JOIN
face AS f ON c.id = f.card_id
LEFT JOIN (
SELECT
cl.card_id,
SUM(CASE WHEN cl.format_id = 1 THEN 1 ELSE 0 END) > 0 AS pd_legal,
GROUP_CONCAT(CONCAT(fo.name, ':', cl.legality)) AS legalities
FROM
card_legality AS cl
LEFT JOIN
format AS fo ON cl.format_id = fo.id
GROUP BY
cl.card_id
) AS cl ON cl.card_id = c.id
GROUP BY
f.id
ORDER BY
f.card_id, f.position
) AS u
LEFT JOIN (
SELECT
cb.card_id,
GROUP_CONCAT(CONCAT(cb.description, '|', cb.classification, '|', cb.last_confirmed, '|', cb.url, '|', cb.from_bug_blog, '|', cb.bannable) SEPARATOR '_SEPARATOR_') AS bugs
FROM
card_bug AS cb
GROUP BY
cb.card_id
) AS bugs ON u.id = bugs.card_id
WHERE u.id IN (SELECT c.id FROM card AS c INNER JOIN face AS f ON c.id = f.card_id WHERE (1 = 1))
GROUP BY u.id
` with `[]` because of `(1205, 'Lock wait timeout exceeded; try restarting transaction')`
Stack Trace:
```
Python traceback
File "run.py", line 174, in
cli()
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "run.py", line 104, in task
multiverse.init()
File "/home/discord/decksite/magic/multiverse.py", line 26, in init
return event_loop.run_until_complete(init_async())
File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/discord/decksite/magic/multiverse.py", line 39, in init_async
rebuild_cache()
File "/home/discord/decksite/magic/multiverse.py", line 434, in rebuild_cache
db().execute(create_table_def('_new_cache_card', card.base_query_properties(), base_query()))
File "/home/discord/decksite/shared/database.py", line 48, in execute
[n, _] = self.execute_anything(sql, args, False)
File "/home/discord/decksite/shared/database.py", line 63, in execute_anything
raise DatabaseException('Failed to execute `{sql}` with `{args}` because of `{e}`'.format(sql=sql, args=args, e=e))
```
DatabaseException
Failed to execute `CREATE TABLE IF NOT EXISTS `_new_cache_card` (`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT , `name` VARCHAR(190) NOT NULL , `mana_cost` VARCHAR(190) , `cmc` REAL , `power` VARCHAR(190) , `toughness` VARCHAR(190) , `loyalty` VARCHAR(190) , `type_line` VARCHAR(190) NOT NULL , `oracle_text` LONGTEXT NOT NULL , `hand` INTEGER , `life` INTEGER , `position` VARCHAR(190) NOT NULL , `card_id` INTEGER NOT NULL , `layout` VARCHAR(190) NOT NULL , `legalities` LONGTEXT , `names` LONGTEXT , `pd_legal` BOOLEAN , `bugs` LONGTEXT , FOREIGN KEY (`card_id`) REFERENCES `card`(`id`)) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS
SELECT
`u`.`id` AS `id`,
CASE
WHEN layout = 'transform' OR layout = 'flip' OR layout = 'meld' OR layout = 'adventure' THEN
GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN face_name ELSE '' END SEPARATOR '')
ELSE
GROUP_CONCAT(face_name SEPARATOR ' // ' )
END
AS name,
CASE
WHEN layout = 'flip' THEN
GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN mana_cost ELSE '' END SEPARATOR '')
ELSE
GROUP_CONCAT(`u`.`mana_cost` SEPARATOR '|')
END
AS mana_cost,
CASE
WHEN layout = 'split' THEN
SUM(CASE WHEN `u`.cmc IS NOT NULL THEN `u`.cmc ELSE 0 END)
ELSE
SUM(CASE WHEN `u`.position = 1 THEN `u`.cmc ELSE 0 END)
END
AS cmc, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`power` ELSE '' END SEPARATOR '') AS `power`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`toughness` ELSE '' END SEPARATOR '') AS `toughness`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`loyalty` ELSE '' END SEPARATOR '') AS `loyalty`,
GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN type_line ELSE '' END SEPARATOR '')
AS type_line, GROUP_CONCAT(`u`.`oracle_text` SEPARATOR '
-----
') AS `oracle_text`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`hand` ELSE 0 END) AS `hand`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`life` ELSE 0 END) AS `life`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`position` ELSE '' END SEPARATOR '') AS `position`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`card_id` ELSE 0 END) AS `card_id`, `u`.`layout` AS `layout`, legalities, GROUP_CONCAT(face_name SEPARATOR '|') AS names, `u`.`pd_legal` AS `pd_legal`, bugs
FROM (
SELECT c.id, c.layout, f.mana_cost, f.cmc, f.power, f.toughness, f.loyalty, f.type_line, f.oracle_text, f.hand, f.life, f.position, f.card_id, f.name AS face_name,
pd_legal,
legalities
FROM
card AS c
INNER JOIN
face AS f ON c.id = f.card_id
LEFT JOIN (
SELECT
cl.card_id,
SUM(CASE WHEN cl.format_id = 1 THEN 1 ELSE 0 END) > 0 AS pd_legal,
GROUP_CONCAT(CONCAT(fo.name, ':', cl.legality)) AS legalities
FROM
card_legality AS cl
LEFT JOIN
format AS fo ON cl.format_id = fo.id
GROUP BY
cl.card_id
) AS cl ON cl.card_id = c.id
GROUP BY
f.id
ORDER BY
f.card_id, f.position
) AS u
LEFT JOIN (
SELECT
cb.card_id,
GROUP_CONCAT(CONCAT(cb.description, '|', cb.classification, '|', cb.last_confirmed, '|', cb.url, '|', cb.from_bug_blog, '|', cb.bannable) SEPARATOR '_SEPARATOR_') AS bugs
FROM
card_bug AS cb
GROUP BY
cb.card_id
) AS bugs ON u.id = bugs.card_id
WHERE u.id IN (SELECT c.id FROM card AS c INNER JOIN face AS f ON c.id = f.card_id WHERE (1 = 1))
GROUP BY u.id
` with `[]` because of `(1205, 'Lock wait timeout exceeded; try restarting transaction')`
Stack Trace:
```
Python traceback
File "run.py", line 174, in
cli()
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/discord/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "run.py", line 104, in task
multiverse.init()
File "/home/discord/decksite/magic/multiverse.py", line 26, in init
return event_loop.run_until_complete(init_async())
File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/discord/decksite/magic/multiverse.py", line 39, in init_async
rebuild_cache()
File "/home/discord/decksite/magic/multiverse.py", line 434, in rebuild_cache
db().execute(create_table_def('_new_cache_card', card.base_query_properties(), base_query()))
File "/home/discord/decksite/shared/database.py", line 48, in execute
[n, _] = self.execute_anything(sql, args, False)
File "/home/discord/decksite/shared/database.py", line 63, in execute_anything
raise DatabaseException('Failed to execute `{sql}` with `{args}` because of `{e}`'.format(sql=sql, args=args, e=e))
```
Reported on CLI by CLI
DatabaseException Failed to execute `CREATE TABLE IF NOT EXISTS `_new_cache_card` (`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT , `name` VARCHAR(190) NOT NULL , `mana_cost` VARCHAR(190) , `cmc` REAL , `power` VARCHAR(190) , `toughness` VARCHAR(190) , `loyalty` VARCHAR(190) , `type_line` VARCHAR(190) NOT NULL , `oracle_text` LONGTEXT NOT NULL , `hand` INTEGER , `life` INTEGER , `position` VARCHAR(190) NOT NULL , `card_id` INTEGER NOT NULL , `layout` VARCHAR(190) NOT NULL , `legalities` LONGTEXT , `names` LONGTEXT , `pd_legal` BOOLEAN , `bugs` LONGTEXT , FOREIGN KEY (`card_id`) REFERENCES `card`(`id`)) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci AS SELECT `u`.`id` AS `id`, CASE WHEN layout = 'transform' OR layout = 'flip' OR layout = 'meld' OR layout = 'adventure' THEN GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN face_name ELSE '' END SEPARATOR '') ELSE GROUP_CONCAT(face_name SEPARATOR ' // ' ) END AS name, CASE WHEN layout = 'flip' THEN GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN mana_cost ELSE '' END SEPARATOR '') ELSE GROUP_CONCAT(`u`.`mana_cost` SEPARATOR '|') END AS mana_cost, CASE WHEN layout = 'split' THEN SUM(CASE WHEN `u`.cmc IS NOT NULL THEN `u`.cmc ELSE 0 END) ELSE SUM(CASE WHEN `u`.position = 1 THEN `u`.cmc ELSE 0 END) END AS cmc, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`power` ELSE '' END SEPARATOR '') AS `power`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`toughness` ELSE '' END SEPARATOR '') AS `toughness`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`loyalty` ELSE '' END SEPARATOR '') AS `loyalty`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN type_line ELSE '' END SEPARATOR '') AS type_line, GROUP_CONCAT(`u`.`oracle_text` SEPARATOR ' ----- ') AS `oracle_text`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`hand` ELSE 0 END) AS `hand`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`life` ELSE 0 END) AS `life`, GROUP_CONCAT(CASE WHEN `u`.position = 1 THEN `u`.`position` ELSE '' END SEPARATOR '') AS `position`, SUM(CASE WHEN `u`.position = 1 THEN `u`.`card_id` ELSE 0 END) AS `card_id`, `u`.`layout` AS `layout`, legalities, GROUP_CONCAT(face_name SEPARATOR '|') AS names, `u`.`pd_legal` AS `pd_legal`, bugs FROM ( SELECT c.id, c.layout, f.mana_cost, f.cmc, f.power, f.toughness, f.loyalty, f.type_line, f.oracle_text, f.hand, f.life, f.position, f.card_id, f.name AS face_name, pd_legal, legalities FROM card AS c INNER JOIN face AS f ON c.id = f.card_id LEFT JOIN ( SELECT cl.card_id, SUM(CASE WHEN cl.format_id = 1 THEN 1 ELSE 0 END) > 0 AS pd_legal, GROUP_CONCAT(CONCAT(fo.name, ':', cl.legality)) AS legalities FROM card_legality AS cl LEFT JOIN format AS fo ON cl.format_id = fo.id GROUP BY cl.card_id ) AS cl ON cl.card_id = c.id GROUP BY f.id ORDER BY f.card_id, f.position ) AS u LEFT JOIN ( SELECT cb.card_id, GROUP_CONCAT(CONCAT(cb.description, '|', cb.classification, '|', cb.last_confirmed, '|', cb.url, '|', cb.from_bug_blog, '|', cb.bannable) SEPARATOR '_SEPARATOR_') AS bugs FROM card_bug AS cb GROUP BY cb.card_id ) AS bugs ON u.id = bugs.card_id WHERE u.id IN (SELECT c.id FROM card AS c INNER JOIN face AS f ON c.id = f.card_id WHERE (1 = 1)) GROUP BY u.id ` with `[]` because of `(1205, 'Lock wait timeout exceeded; try restarting transaction')`
Stack Trace: ``` Python traceback File "run.py", line 174, inException_hash: 824bf77b474906ec4b2367cf24070e36ceea29db