cwida / duckpgq-extension

DuckDB extension that adds support for SQL/PGQ
https://duckpgq.notion.site/b8ac652667964f958bfada1c3e53f1bb?v=3b47a8d44bdf4e0c8b503bf23f1b76f2
MIT License
86 stars 7 forks source link

Persist PGQ database objects across sessions #97

Closed dbeatty10 closed 3 weeks ago

dbeatty10 commented 9 months ago

What happens?

After opening a persistent database (rather than a transient in-memory DuckDB database), I expected PGQ objects to persist after exiting and re-starting.

But I got this error instead:

Error: Binder Error: Property graph snb does not exist

To Reproduce

This works:

$ ./build/release/duckdb db.db
-CREATE OR REPLACE TABLE tbl1 AS SELECT 1;
-SELECT * FROM tbl1;
.exit
./build/release/duckdb db.db
-SELECT * FROM tbl1;

But this doesn’t:

Open a persistent database file (which will create it if it doesn't already exist):

$ ./build/release/duckdb db.db

Create a property graph, do a PGQ query, and then exit:

import database 'duckdb-pgq/data/SNB0.003';

-CREATE PROPERTY GRAPH snb
  VERTEX TABLES (
      Person LABEL Person
      )
  EDGE TABLES (
      person_knows_person     SOURCE KEY ( person1id ) REFERENCES Person ( id )
                              DESTINATION KEY ( person2id ) REFERENCES Person ( id )
                              LABEL Knows
      );

-FROM GRAPH_TABLE(snb
  MATCH (a:Person WHERE a.firstName = 'Jan')-[k:Knows]->(b:Person)
  COLUMNS (b.firstName)
  );

.exit

Re-open the file for the persistent database:

$ ./build/release/duckdb db.db

And try the same query again:

-FROM GRAPH_TABLE(snb
  MATCH (a:Person WHERE a.firstName = 'Jan')-[k:Knows]->(b:Person)
  COLUMNS (b.firstName)
  );

Output:

Error: Binder Error: Property graph snb does not exist

Environment

OS: macOS Version: duckdb-pgq v0.10.0 3e6d77b923

After following these installation instructions, here is my current version:

$ ./build/release/duckdb --version

v0.10.0 3e6d77b923
Dtenwolde commented 9 months ago

By design, property graphs only exist within the lifecycle of a connection. This means that once the connection is closed, the property graph is also removed. In a future version I would like to make property graphs persistent, so I'll leave this issue open EDIT: Clarified in documentation here

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.