Run SQL queries against Wikidata by translating them to SPARQL
Project description
Wikidata-SQL
Run SQL queries against Wikidata. Instead of writing SPARQL, write familiar SQL using Wikidata Q-IDs as table names.
Quick Start
pip install -e .
wikisql
How It Works
A Q-ID in the FROM clause creates a virtual table of all entities with that class:
-- All Shinto shrines (instances of Q845945)
SELECT * FROM Q845945 LIMIT 10;
This translates to:
SELECT ?item ?itemLabel WHERE {
?item wdt:P31 wd:Q845945 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
LIMIT 10
Custom Properties
By default, FROM Q... uses P31 (instance of). Prefix with a property to change this:
-- Subclasses of Shinto shrine
SELECT * FROM P279:Q845945 LIMIT 10;
Usage
Interactive REPL:
wikisql
Single query:
wikisql "SELECT * FROM Q845945 LIMIT 10"
Show generated SPARQL:
wikisql --sparql "SELECT * FROM Q845945 LIMIT 10"
Change label language:
wikisql -l ja "SELECT * FROM Q845945 LIMIT 10"
REPL Commands
\sparql- Toggle SPARQL display on/off\q/quit/exit- Exit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wikisql-0.1.0.tar.gz.
File metadata
- Download URL: wikisql-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96ee5f1007ddf57ac20d371a4b20d824f09cffb2e8a7b3b884d8d406fcec9626
|
|
| MD5 |
bf6aae65ef0b015857cc1f69b5eb9f75
|
|
| BLAKE2b-256 |
db472b771f784baaeed3daac211dcced93913f4c91128161d2b863faf9b7020d
|
Provenance
The following attestation bundles were made for wikisql-0.1.0.tar.gz:
Publisher:
workflow.yml on Emma-Leonhart/WikiSQL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wikisql-0.1.0.tar.gz -
Subject digest:
96ee5f1007ddf57ac20d371a4b20d824f09cffb2e8a7b3b884d8d406fcec9626 - Sigstore transparency entry: 1004824845
- Sigstore integration time:
-
Permalink:
Emma-Leonhart/WikiSQL@3bfedca69de3ee2848f37bf19c0e184138584141 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Emma-Leonhart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@3bfedca69de3ee2848f37bf19c0e184138584141 -
Trigger Event:
release
-
Statement type:
File details
Details for the file wikisql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wikisql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b977cbac771a8ad2c254db0cc5849fd138d677ccd5a56c56b4e45e4fe47142e7
|
|
| MD5 |
a3a9a545a441e8ce34164f362ce5026b
|
|
| BLAKE2b-256 |
3a16cbcca8d0aa9f684eadc65bb3e5272dd4a5245c56fb50e77db9985bbe9515
|
Provenance
The following attestation bundles were made for wikisql-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on Emma-Leonhart/WikiSQL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wikisql-0.1.0-py3-none-any.whl -
Subject digest:
b977cbac771a8ad2c254db0cc5849fd138d677ccd5a56c56b4e45e4fe47142e7 - Sigstore transparency entry: 1004824846
- Sigstore integration time:
-
Permalink:
Emma-Leonhart/WikiSQL@3bfedca69de3ee2848f37bf19c0e184138584141 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Emma-Leonhart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@3bfedca69de3ee2848f37bf19c0e184138584141 -
Trigger Event:
release
-
Statement type: