Skip to content

Commit

Permalink
Merge pull request #31 from ChinthapallyAkanksha/spark-3.1
Browse files Browse the repository at this point in the history
Fixed collection variable and changed scala version.
  • Loading branch information
badrinathpatchikolla authored Nov 18, 2022
2 parents d7bcaab + d9ec101 commit 7b51510
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 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 @@ -4,13 +4,13 @@

To add Mongodb Almaren dependency to your sbt build:
```
libraryDependencies += "com.github.music-of-the-ainur" %% "mongodb-almaren" % "0.0.7-3.1"
libraryDependencies += "com.github.music-of-the-ainur" %% "mongodb-almaren" % "0.0.8-3.1"
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.1,com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.7-3.1,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.1,com.github.music-of-the-ainur:mongodb-almaren_2.12:0.0.8-3.1,org.mongodb.spark:mongo-spark-connector:10.0.4"
```

MongoDB Connector is available in
Expand All @@ -19,11 +19,11 @@ repository.

| versions | 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 @@ -72,7 +72,6 @@ private[almaren] case class TargetMongoDb(
.save
df
}

}

private[almaren] case class TargetMongoDbx(
Expand All @@ -83,14 +82,13 @@ private[almaren] case class TargetMongoDbx(

def target(df: DataFrame): DataFrame = {
logger.info(s"collection:{$collection}, options:{$options}, saveMode:{$saveMode}")
val params = options ++ Map("connection.uri" -> uri, "collection" -> "collection") ++ options
val params = options ++ Map("connection.uri" -> uri, "collection" -> collection) ++ options
df.write.format("mongodb")
.options(params)
.mode(saveMode)
.save
df
}

}

private[almaren] trait MongoDbConnector extends Core {
Expand Down

0 comments on commit 7b51510

Please sign in to comment.