Skip to content

Commit

Permalink
Added pyshell calling lines and python file header
Browse files Browse the repository at this point in the history
discussed in #50
Thanks to @Reid00
  • Loading branch information
wey-gu authored Aug 23, 2022
1 parent 9c690e1 commit 1f6ba00
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,34 @@ df.write.format("com.vesoft.nebula.connector.NebulaDataSource").option(
"user", "root").save()
```
Also, below are examples on how we run above code with pyspark shell or in python code files:
- Call with PySpark shell:
```bash
/spark/bin/pyspark --driver-class-path nebula-spark-connector-3.0.0.jar --jars nebula-spark-connector-3.0.0.jar
```
- In Python code:
```
from pyspark.sql import SparkSession

spark = SparkSession.builder.config(
"nebula-spark-connector-3.0.0.jar",
"/path_to/nebula-spark-connector-3.0.0.jar").appName(
"nebula-connector").getOrCreate()

df = spark.read.format(
"com.vesoft.nebula.connector.NebulaDataSource").option(
"type", "vertex").option(
"spaceName", "basketballplayer").option(
"label", "player").option(
"returnCols", "name,age").option(
"metaAddress", "metad0:9559").option(
"partitionNumber", 1).load()
```
## Version match
There are the version correspondence between Nebula Spark Connector and Nebula:
Expand Down

0 comments on commit 1f6ba00

Please sign in to comment.