Skip to content

--namespace bug when running a second time #42

@simonw

Description

@simonw

Spotted here: https://github.com/simonw/git-history/runs/4447682089?check_suite_focus=true

  File "/home/runner/work/git-history/git-history/git_history/cli.py", line 544, in get_versions_and_hashes
    for row in db.query(sql):
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/sqlite_utils/db.py", line 410, in query
    cursor = self.execute(sql, params or tuple())
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages/sqlite_utils/db.py", line 422, in execute
    return self.conn.execute(sql, parameters)
sqlite3.OperationalError: no such column: item._id

The problem is here:

sql = """
select
{namespace}._item_id as item_id,
max({namespace}_version._version) as max_version,
{namespace}_version._item_full_hash as item_full_hash
from
{namespace}_version
join {namespace} on {namespace}_version._item = item._id
group by
_item_id

join {namespace} on {namespace}_version._item = item._id should be join {namespace} on {namespace}_version._item = {namespace}._id

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions