Skip to content

Commit

Permalink
Merge pull request #104 from cwida/100-parser-extension-doesnt-work-i…
Browse files Browse the repository at this point in the history
…n-python-environment

Extension now also works in python environment
  • Loading branch information
Dtenwolde authored Mar 12, 2024
2 parents 5c324a7 + 0787383 commit e2360ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion duckdb-pgq
Submodule duckdb-pgq updated 0 files
18 changes: 12 additions & 6 deletions test/python/duckpgq_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@
import os
import pytest


# Get a fresh connection to DuckDB with the duckpgq extension binary loaded
@pytest.fixture
def duckdb_conn():
extension_binary = os.getenv('DUCKPGQ_EXTENSION_BINARY_PATH')
if (extension_binary == ''):
if extension_binary == '':
raise Exception('Please make sure the `DUCKPGQ_EXTENSION_BINARY_PATH` is set to run the python tests')
conn = duckdb.connect('', config={'allow_unsigned_extensions': 'true'})
conn.execute(f"load '{extension_binary}'")
return conn


def test_duckpgq(duckdb_conn):
duckdb_conn.execute("SELECT duckpgq('Sam') as value;");
duckdb_conn.execute("SELECT duckpgq('Sam') as value;")
res = duckdb_conn.fetchall()
assert(res[0][0] == "Duckpgq Sam 🐥");
assert (res[0][0] == "Duckpgq Sam 🐥");


def test_duckpgq_openssl_version_test(duckdb_conn):
duckdb_conn.execute("SELECT duckpgq_openssl_version('Michael');");
def test_property_graph(duckdb_conn):
duckdb_conn.execute("CREATE TABLE foo(i bigint)")
duckdb_conn.execute("INSERT INTO foo(i) VALUES (1)")
duckdb_conn.execute("-CREATE PROPERTY GRAPH t VERTEX TABLES (foo);")
duckdb_conn.execute("-FROM GRAPH_TABLE(t MATCH (f:foo))")
res = duckdb_conn.fetchall()
assert(res[0][0][0:51] == "Duckpgq Michael, my linked OpenSSL version is OpenSSL");
assert (res[0][0] == 1)

0 comments on commit e2360ad

Please sign in to comment.