Skip to content

Commit

Permalink
Modified view name and doc.
Browse files Browse the repository at this point in the history
Prefix the view name with a `v_` to distinguish it in the schema from
actual tables.

Also add a description of the view with a table that defines the
columns.
  • Loading branch information
edsu committed Oct 30, 2023
1 parent 1a4fcb5 commit 789ca95
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,19 @@ Here's the relational schema of the `.warcdb` file.
![WarcDB Schema](schema.png)
In addition to the core tables that map to the WARC record types there are also helper views that make it a bit easier to query data:
### Views
- *http_header*: A view of HTTP headers in responses where each row is a tuple of `(warc_record_id, name, value)`
In addition to the core tables that map to the WARC record types there are also helper *views* that make it a bit easier to query data:
#### v_http_header
A view of HTTP headers in WARC response records:
| Column Name | Column Type | Description |
| -------------- | ----------- | ---------------------------------------------------------------------- |
| warc_record_id | text | The WARC-Record-Id for the *response* record that it was extracted from. |
| name | text | The lowercased HTTP header name (e.g. content-type) |
| value | text | The HTTP header value (e.g. text/html) |
## Motivation
Expand Down
2 changes: 1 addition & 1 deletion tests/test_warcdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_http_header():
)

db = sqlite_utils.Database(db_file)
headers = list(db["http_header"].rows)
headers = list(db["v_http_header"].rows)
assert len(headers) == 43
assert {
"name": "content-type",
Expand Down
2 changes: 1 addition & 1 deletion warcdb/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def m001_initial(db):
@migration()
def m002_headers(db):
db.create_view(
"http_header",
"v_http_header",
"""
SELECT
response.warc_record_id AS warc_record_id,
Expand Down

0 comments on commit 789ca95

Please sign in to comment.