Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit 6b97d00

Browse files
committed
Project structure for PGXN
1 parent 250b5ea commit 6b97d00

File tree

6 files changed

+101
-13
lines changed

6 files changed

+101
-13
lines changed

META.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "neo4j-fdw",
3+
"abstract": "PostgreSQL foreign data wrapper for Neo4j Graph Database",
4+
"description": "Neo4j multicorn foreign data wrapper extension for PostgreSQL",
5+
"version": "@@VERSION@@",
6+
"maintainer": [
7+
"Benoit Simard <[email protected]>"
8+
],
9+
"license": "GPL3",
10+
"prereqs": {
11+
"runtime": {
12+
"requires": {
13+
"Python": "2.6.0",
14+
"PostgreSQL": "9.1.0"
15+
}
16+
}
17+
},
18+
"provides": {
19+
"neo4jPg": {
20+
"abstract": "PostgreSQL foreign data wrapper for Neo4j Graph Database",
21+
"file": "sql/neo4j-fdw.sql",
22+
"docfile": "./README.adoc",
23+
"version": "@@VERSION@@"
24+
}
25+
},
26+
"resources": {
27+
"bugtracker": {
28+
"web": "http://github.com/sim51/neo4j-fdw/issues/"
29+
},
30+
"repository": {
31+
"url": "git://github.com/sim51/neo4j-fdw.git",
32+
"web": "http://github.com/sim51/neo4j-fdw/",
33+
"type": "git"
34+
}
35+
},
36+
"generated_by": "Benoit Simard",
37+
"meta-spec": {
38+
"version": "1.0.0",
39+
"url": "http://pgxn.org/meta/spec.txt"
40+
},
41+
"tags": [
42+
"neo4j",
43+
"multicorn",
44+
"foreign data wrapper"
45+
]
46+
}

Makefile

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
MODULE_NAME = neo4j-fdw
2-
PYTHON ?= python
3-
PKGDIR = $$($(PYTHON) -c "import site; print(site.getsitepackages()[0])")
4-
NAME = $$($(PYTHON) setup.py --name)
5-
VERSION = $$($(PYTHON) setup.py --version)
6-
PYVERSION = $$($(PYTHON) -c "import sys; print(sys.version[:3])")
1+
MODULE_NAME = neo4j-fdw
2+
NAME = $$($(PYTHON) setup.py --name)
3+
EXTVERSION = $(shell grep default_version ./$(MODULE_NAME).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
4+
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
5+
DOCS = README.adoc
6+
MODULEDIR = neo4j-fdw
7+
8+
PYTHON ?= python
9+
PKGDIR = $$($(PYTHON) -c "import site; print(site.getsitepackages()[0])")
10+
PYVERSION = $$($(PYTHON) -c "import sys; print(sys.version[:3])")
711

812
.PHONY: all install test uninstall clean
913

@@ -12,11 +16,19 @@ all: install
1216
test:
1317
@./scripts/test.sh
1418

15-
install:
16-
@$(PYTHON) setup.py install
19+
install: python_code
1720

18-
uninstall:
19-
@rm -f $(PKGDIR)/$(NAME)-$(VERSION)-py$(PYVERSION).egg
21+
python_code: setup.py
22+
cp ./setup.py ./setup--$(EXTVERSION).py
23+
sed -i -e "s/@@VERSION@@/$(EXTVERSION)-dev/g" ./setup--$(EXTVERSION).py
24+
$(PYTHON) ./setup--$(EXTVERSION).py install
25+
rm ./setup--$(EXTVERSION).py
2026

2127
clean:
2228
@$(PYTHON) setup.py clean
29+
@rm -f $(PKGDIR)/$(NAME)-$(EXTVERSION)-py$(PYVERSION).egg
30+
31+
32+
PG_CONFIG = pg_config
33+
PGXS := $(shell $(PG_CONFIG) --pgxs)
34+
include $(PGXS)

neo4j-fdw.control

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
comment = 'Neo4j multicorn foreign data wrapper extension for PostgreSQL'
2+
default_version = '1.1.0'
3+
module_pathname = '$libdir/neo4jPg'
4+
relocatable = true

neo4jPg/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
__email__ = "[email protected]"
33
__url__ = "https://github.com/sim51/neo4j-fdw"
44
__package__ = "neo4jPg"
5-
__version__ = "3.5"
5+
__version__ = '@@VERSION@@'

setup.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
setup(
55
name = neo4jPg.__package__,
6-
version = neo4jPg.__version__,
7-
description = "",
6+
version = "@@VERSION@@",
87
author = neo4jPg.__author__,
98
author_email = neo4jPg.__email__,
109
url = neo4jPg.__url__,

sql/neo4j-fdw.sql

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CREATE EXTENSION multicorn;
2+
3+
CREATE EXTENSION plpythonu;
4+
5+
CREATE OR REPLACE FUNCTION cypher(query text) RETURNS SETOF json
6+
LANGUAGE plpythonu
7+
AS $$
8+
from neo4jPg import neo4jPGFunction
9+
for result in neo4jPGFunction.cypher_default_server(plpy, query, '{}'):
10+
yield result
11+
$$;
12+
13+
CREATE OR REPLACE FUNCTION cypher(query text, params text) RETURNS SETOF json
14+
LANGUAGE plpythonu
15+
AS $$
16+
from neo4jPg import neo4jPGFunction
17+
for result in neo4jPGFunction.cypher_default_server(plpy, query, params):
18+
yield result
19+
$$;
20+
21+
CREATE OR REPLACE FUNCTION cypher(query text, params text, server text) RETURNS SETOF json
22+
LANGUAGE plpythonu
23+
AS $$
24+
from neo4jPg import neo4jPGFunction
25+
for result in neo4jPGFunction.cypher_with_server(plpy, query, params, server):
26+
yield result
27+
$$;

0 commit comments

Comments
 (0)