Create procedure to project graph from BigQuery dataset

This feature is experimental and not ready for use in production. It is only available as part of an Early Access Program, and can go under breaking changes until general availability.

We can now create our first stored procedure that creates graph projection from our BigQuery dataset. Execute the following SQL script, replacing the placeholders to reflect your own environment.

CREATE OR REPLACE PROCEDURE
  `<gcp-project-id>.<bigquery-dataset>.neo4j_gds_graph_project`(
    graph_name STRING, (1)
    graph_uri STRING, (2)
    neo4j_secret STRING, (3)
    bq_project STRING, (4)
    bq_dataset STRING, (5)
    node_tables ARRAY<STRING>, (6)
    edge_tables ARRAY<STRING>) (7)
WITH CONNECTION `<gcp-project-id>.<region>.<external-connection-id>` OPTIONS (
    engine='SPARK',
    runtime_version='2.1',
    container_image='<region>-docker.pkg.dev/<gcp-project-id>/<repository-name>/neo4j-bigquery-connector:<version>',
    properties=[],
    description="Project a graph from BigQuery into Neo4j GDS/AuraDS.")
  LANGUAGE python AS R"""
from pyspark.sql import SparkSession
from templates import BigQueryToNeo4jGDSTemplate

spark = (
      SparkSession
      .builder
      .appName("Neo4j BigQuery Connector")
      .getOrCreate()
)

template = BigQueryToNeo4jGDSTemplate()
hardcoded = [
    "--neo4j_action=CREATE_GRAPH"
]
args = template.parse_args(hardcoded)
template.run(spark, args)
""";
1 Name of the graph projection to be created in Neo4j GDS/AuraDS. The procedure will fail if there is already an existing graph projection with the same name.
2 URI to a Google Cloud Storage object that defines the graph mapping model. Refer to Map your tabular data into graph entities for details.
3 Secret identifier that contains Neo4j connection parameters.
4 Google Cloud Project ID that contains the BigQuery dataset.
5 Name of the BigQuery dataset.
6 List of tables to source node records from.
7 List of tables to source edge records from.