mirror of
https://github.com/NexVeridian/wikidata-to-surrealdb.git
synced 2025-09-02 01:49:13 +00:00
more error handling and overwrite option
This commit is contained in:
parent
e37d413372
commit
8905c88819
8 changed files with 76 additions and 23 deletions
|
@ -9,6 +9,7 @@ use wikidata_to_surrealdb::utils::*;
|
|||
|
||||
async fn inti_db() -> Result<Surreal<Db>, Error> {
|
||||
env::set_var("WIKIDATA_LANG", "en");
|
||||
env::set_var("OVERWRITE_DB", "true");
|
||||
|
||||
let db = Surreal::new::<Mem>(()).await?;
|
||||
db.use_ns("wikidata").use_db("wikidata").await?;
|
||||
|
@ -40,7 +41,7 @@ async fn entity() {
|
|||
.unwrap();
|
||||
|
||||
for line in reader.lines() {
|
||||
create_db_entity(&db, line.unwrap()).await.unwrap();
|
||||
create_db_entity(&db, &line.unwrap()).await.unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(51.0, entity_query(&db).await.unwrap().unwrap())
|
||||
|
@ -82,7 +83,7 @@ async fn property() {
|
|||
.unwrap();
|
||||
|
||||
for line in reader.lines() {
|
||||
create_db_entity(&db, line.unwrap()).await.unwrap();
|
||||
create_db_entity(&db, &line.unwrap()).await.unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(2.0, property_query(&db).await.unwrap().unwrap())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue