Skip to content

Allow acyclic SQLite schemas with more than one hundred tables - #90

Merged
xrotwang merged 1 commit into
cldf:masterfrom
antonsoo:fix/sqlite-large-acyclic-groups
Oct 28, 2026
Merged

xrotwang merged 1 commit into
cldf:masterfrom
antonsoo:fix/sqlite-large-acyclic-groups

Conversation

@antonsoo

Copy link
Copy Markdown
Contributor

A valid group with 101 tables currently raises ValueError: there seem to be cyclic dependencies between the tables, even when no table has a foreign key:

from csvw import TableGroup
from csvw.db import Database

tg = TableGroup.fromvalue({'tables': [
    {'url': f't{i}', 'tableSchema': {'columns': [{'name': 'ID'}]}}
    for i in range(101)
]})
print(len(Database(tg).tables))

The ordering loop removes one eligible table per pass but stops after 100 passes. Continue while tables remain, and stop as cyclic only when a complete pass makes no progress. Add forward/reversed 103-table dependency-chain round trips and a real two-table-cycle check.

Validation: full suites pass on Python 3.12 (842 passed, 16 expected failures) and 3.9 (845 passed, 13 expected failures), with 100% configured coverage; changed source/test Flake8 passes. Published Concepticon list collections of 101 and 113 tables now import successfully in both table orders, with every stored row and cross-list concept frequency matching raw TSV references. Six complete imports at 2/97/100 tables are unchanged. Source on both Python profiles and a fresh installed wheel agree. Four nonrectangular released list files are explicitly excluded without editing their data.

@xrotwang
xrotwang merged commit b81ce32 into cldf:master Oct 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants