self = <swh.storage.tests.test_storage.TestStorage object at 0x7f45ba014be0>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f45ba0140f0>
def test_origin_search_single_result(self, swh_storage):
> found_origins = list(swh_storage.origin_search(data.origin["url"]))
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1467:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:97: in _meth
yield from meth(self, *args, db=db, cur=cur, **kwargs)
.tox/py3/lib/python3.7/site-packages/swh/storage/storage.py:1176: in origin_search
url_pattern, offset, limit, regexp, with_visit, cur
.tox/py3/lib/python3.7/site-packages/swh/storage/db.py:1004: in origin_search
cur=cur,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.db.Db object at 0x7f45ba0145c0>
url_pattern = 'file:///dev/null', count = False, offset = 0, limit = 50
regexp = False, with_visit = False
cur = <cursor object at 0x7f478e6b1dd8; closed: -1>
def _origin_query(
self,
url_pattern,
count=False,
offset=0,
limit=50,
regexp=False,
with_visit=False,
cur=None,
):
"""
Method factorizing query creation for searching and counting origins.
"""
cur = self._cursor(cur)
if count:
origin_cols = "COUNT(*)"
else:
origin_cols = ",".join(self.origin_cols)
query = """SELECT %s
FROM origin
WHERE """
if with_visit:
query += """
EXISTS (
SELECT 1
FROM origin_visit
INNER JOIN snapshot ON snapshot=snapshot.id
WHERE origin=origin.id
)
AND """
query += "url %s %%s "
if not count:
query += "ORDER BY id OFFSET %%s LIMIT %%s"
if not regexp:
query = query % (origin_cols, "ILIKE")
query_params = ("%" + url_pattern + "%", offset, limit)
else:
query = query % (origin_cols, "~*")
query_params = (url_pattern, offset, limit)
if count:
query_params = (query_params[0],)
> cur.execute(query, query_params)
E psycopg2.errors.UndefinedTable: relation "origin" does not exist
E LINE 2: FROM origin
E ^
.tox/py3/lib/python3.7/site-packages/swh/storage/db.py:979: UndefinedTable
TEST RESULT
TEST RESULT
- Run At
- May 20 2020, 9:28 AM