Skip to content

Commit

Permalink
Merge pull request #29 from sharath-sg2706/spark-3.3
Browse files Browse the repository at this point in the history
fixed collection variable-3.3
  • Loading branch information
badrinathpatchikolla authored Nov 18, 2022
2 parents fe1a008 + b429d56 commit dfc5762
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mongodb-almaren-githubactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
PGPASSWORD="postgres" psql -c "ALTER USER postgres PASSWORD 'postgres' ;" -U postgres -h localhost
PGPASSWORD="postgres" psql -c 'create role runner;' -U postgres -h localhost
PGPASSWORD="postgres" psql -c 'ALTER ROLE "runner" WITH LOGIN SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;' -U postgres -h localhost
sbt ++2.12.15 test
sbt ++2.12.10 test
rm -rf "$HOME/.ivy2/local" || true
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
To add Mongodb Almaren dependency to your sbt build:

```
libraryDependencies += "com.github.music-of-the-ainur" %% "mongodb-almaren" % "0.0.7-3.3"
libraryDependencies += "com.github.music-of-the-ainur" %% "mongodb-almaren" % "0.0.8-3.3"
libraryDependencies += "org.mongodb.spark" % "mongo-spark-connector" % "10.0.4"
```

To run in spark-shell:

```
spark-shell --master local[*] --packages "com.github.music-of-the-ainur:almaren-framework_2.12:0.9.8-3.3,com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.7-3.3,org.mongodb.spark:mongo-spark-connector:10.0.4"
spark-shell --master local[*] --packages "com.github.music-of-the-ainur:almaren-framework_2.12:0.9.8-3.3,com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.8-3.3,org.mongodb.spark:mongo-spark-connector:10.0.4"
```

MongoDB Connector is available in [Maven Central](https://mvnrepository.com/artifact/com.github.music-of-the-ainur)
repository.

| version | Connector Artifact |
|----------------------------|----------------------------------------------------------------|
| Spark 3.3.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.7-3.3` |
| Spark 3.2.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.7-3.2` |
| Spark 3.1.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.7-3.1` |
| Spark 2.4.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.7-2.4` |
| Spark 2.4.x and scala 2.11 | `com.github.music-of-the-ainur:mongodb-almaren_2.11:0.0.7-2.4` |
| Spark 3.3.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.8-3.3` |
| Spark 3.2.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.8-3.2` |
| Spark 3.1.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.8-3.1` |
| Spark 2.4.x and scala 2.12 | `com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.8-2.4` |
| Spark 2.4.x and scala 2.11 | `com.github.music-of-the-ainur:mongodb-almaren_2.11:0.0.8-2.4` |


## Source and Target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private[almaren] case class SourceMongoDbx(
def source(df: DataFrame): DataFrame = {
logger.info(s" collection:{$collection}, options:{$options}")

val params = Map("connection.uri" -> uri, "collection" -> "collection") ++ options
val params = Map("connection.uri" -> uri, "collection" -> collection) ++ options

df.sparkSession.read.format("mongodb")
.options(params)
Expand Down Expand Up @@ -84,7 +84,7 @@ private[almaren] case class TargetMongoDbx(
def target(df: DataFrame): DataFrame = {
logger.info(s"collection:{$collection}, options:{$options}, saveMode:{$saveMode}")

val params = Map("connection.uri" -> uri, "collection" -> "collection") ++ options
val params = Map("connection.uri" -> uri, "collection" -> collection) ++ options

df.write.format("mongodb")
.options(params)
Expand Down

0 comments on commit dfc5762

Please sign in to comment.