Skip to content

Instantly share code, notes, and snippets.

@rvilla87
rvilla87 / MongoDBsparkConnector.scala
Created August 6, 2017 16:28
Inserting documents in MongoDB with Spark Connector (Dataframe vs Spark Structured Streaming)
// Dataframe (supported) - read 1 file, no streaming
// Step 1, create the Dataframe source
val fileDF = spark
.read // No streaming
.csv("file/file1.csv")
.selectExpr("CAST(key as String)", // more code with other casting...
)
// Out [1]: fileDF: org.apache.spark.sql.package.DataFrame = [key: string, country: string ... 6 more fields]
// Step 2, insert Dataframe into MongoDB
@sloria
sloria / bobp-python.md
Last active May 1, 2024 08:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@digitaljhelms
digitaljhelms / gist:4287848
Last active April 26, 2024 10:44
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch