Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
46e4f57
add batchSize parameter for controlling bulk upload batch size. defau…
unintellisense Jun 28, 2020
144f9f9
update readme
unintellisense Jun 28, 2020
e3f58b0
Merge pull request #1 from loanpal-engineering/add-batch-size-update
unintellisense Jun 28, 2020
bd21e6a
use updated wave-api dependency
unintellisense Jul 12, 2020
707921d
null instead of empty for null objects
unintellisense Jul 14, 2020
af32243
cast null as null
unintellisense Jul 14, 2020
6b4fb6d
use master
unintellisense Jul 14, 2020
eda9081
Merge pull request #2 from loanpal-engineering/nulls-not-empty
unintellisense Jul 14, 2020
131c4f3
spark 3.0/scala 2.12 compatibility
SKinserLoanpal Oct 1, 2020
67ec60a
change to jitpack
SKinserLoanpal Oct 8, 2020
b8c10ea
Merge pull request #3 from loanpal-engineering/spark-3.0
SKinserLoanpal Oct 8, 2020
32effa7
swap out spark version
SKinserLoanpal Oct 8, 2020
0e62d2a
Merge pull request #4 from loanpal-engineering/spark-3.0
SKinserLoanpal Oct 8, 2020
8f72643
use salesforce magic null string value
SKinserLoanpal Feb 1, 2021
e9b423c
maybe empty string is dumb
SKinserLoanpal Feb 2, 2021
d934530
make note of reading/writing
SKinserLoanpal Feb 2, 2021
dedec34
switch to cast
SKinserLoanpal Feb 2, 2021
5f4437f
fix
SKinserLoanpal Feb 2, 2021
6770197
a
SKinserLoanpal Feb 2, 2021
c1d8e0b
add empty string na
SKinserLoanpal Feb 2, 2021
2451cb6
make all null values #N/A aside from dates
SKinserLoanpal Feb 2, 2021
7e068e5
fix dumb mistake
SKinserLoanpal Feb 2, 2021
03491b1
add special case for booleans
SKinserLoanpal Feb 2, 2021
3f9358d
dumb mistake
SKinserLoanpal Feb 2, 2021
f7ed7f2
fix data writer
SKinserLoanpal Feb 2, 2021
99c125d
fix
SKinserLoanpal Feb 2, 2021
4661c15
delete commented code
SKinserLoanpal Feb 3, 2021
e226b20
Merge pull request #5 from loanpal-engineering/null-na
SKinserLoanpal Feb 4, 2021
b6fe136
add support for max column width to csv parser (#6)
unintellisense Apr 27, 2022
7581bf8
shade dependency
SKinserLoanpal Nov 15, 2022
6706341
Merge pull request #8 from loanpal-engineering/spark-3.3.0
SKinserLoanpal Nov 15, 2022
b19abd0
support pkChunks with filtering (handling empty batches)
mweldon-loanpal Mar 17, 2023
fab2d96
Merge pull request #9 from loanpal-engineering/BI-10792
unintellisense Mar 17, 2023
6a658f1
Create codeowners
gwadley-goodleap May 24, 2023
850f035
bulk api 2.0
SKinserLoanpal Nov 29, 2023
e1d7e59
fix
SKinserLoanpal Jan 11, 2024
9a04a88
Merge pull request #10 from loanpal-engineering/spark-3.3.0
SKinserLoanpal Jan 11, 2024
7316f09
change force api to 53
SKinserLoanpal Jan 16, 2024
2d727e8
Merge pull request #11 from loanpal-engineering/spark-3.3.0
SKinserLoanpal Jan 16, 2024
8ccd432
fix max columns
SKinserLoanpal May 23, 2024
bd9c2fa
Merge pull request #14 from loanpal-engineering/spark-3.3.0
SKinserLoanpal May 23, 2024
f66fdd7
Update to use pooled connection for polling events
trampier-goodleap Mar 10, 2026
96e53f1
bumping version
trampier-goodleap Mar 12, 2026
7a56f6f
Updated build toolchain for gradle file, pom file for transient depen…
trampier-goodleap Mar 13, 2026
4b75fd1
Merge pull request #15 from loanpal-engineering/DATA-2401
trampier-goodleap Mar 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/codeowners
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @loanpal-engineering/business-intelligence-bi
.github/codeowners @loanpal-engineering/security @loanpal-engineering/DevOps
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ target/
project/target
dependency-reduced-pom.xml
/bin/
.DS_Store
.databricks
.vscode/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ $ bin/spark-shell --packages com.springml:spark-salesforce_2.11:1.1.3
* `timeout`: (Optional) The maximum time spent polling for the completion of bulk query job. This option can only be used when `bulk` is `true`.
* `externalIdFieldName`: (Optional) The name of the field used as the external ID for Salesforce Object. This value is only used when doing an update or upsert. Default "Id".
* `queryAll`: (Optional) Toggle to retrieve deleted and archived records for SOQL queries. Default value is `false`.
### Options only supported for fetching Salesforce Objects.
* `batchSize`: (Optional) maximum number of records per batch when performing updates. Defaults to 5000 (note that batches greater than 10000 will result in a error)


### Scala API
Expand Down
89 changes: 0 additions & 89 deletions build.sbt

This file was deleted.

202 changes: 202 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.goodleap</groupId>
<artifactId>spark-salesforce</artifactId>
<packaging>jar</packaging>
<description>spark-salesforce</description>
<version>1.1.6</version>
<name>spark-salesforce</name>
<organization>
<name>com.springml</name>
</organization>
<url>https://github.com/springml/spark-salesforce</url>
<licenses>
<license>
<name>Apache License, Verision 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git:github.com/springml/spark-salesforce</connection>
<developerConnection>scm:git:git@github.com:springml/spark-salesforce</developerConnection>
<url>github.com/springml/spark-salesforce</url>
</scm>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<spark.version>3.3.0</spark.version>
<scala.version>2.12.11</scala.version>
<scala.compat.version>2.12</scala.compat.version>
</properties>
<developers>
<developer>
<id>springml</id>
<name>Springml</name>
<url>http://www.springml.com</url>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<!-- -->
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-wsc</artifactId>
<version>53.0.0</version>
</dependency>
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-partner-api</artifactId>
<version>53.0.0</version>
</dependency>
<dependency>
<groupId>com.springml</groupId>
<artifactId>salesforce-wave-api</artifactId>
<version>1.0.8-loanpal</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.loanpal-engineering</groupId>-->
<!-- <artifactId>salesforce-wave-api</artifactId>-->
<!-- <version>1d662ac</version>-->
<!--&lt;!&ndash; <exclusions>&ndash;&gt;-->
<!--&lt;!&ndash; <exclusion>&ndash;&gt;-->
<!--&lt;!&ndash; <groupId>org.codehaus.woodstox</groupId>&ndash;&gt;-->
<!--&lt;!&ndash; <artifactId>stax2-api</artifactId>&ndash;&gt;-->
<!--&lt;!&ndash; </exclusion>&ndash;&gt;-->
<!--&lt;!&ndash; </exclusions>&ndash;&gt;-->
<!-- </dependency>-->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.0.31-beta</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.12</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>endolabs.salesforce</groupId>
<artifactId>bulkv2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.14.2</version>
</dependency>
<dependency>
<groupId>com.frejo</groupId>
<artifactId>force-rest-api</artifactId>
<version>0.0.42</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.codehaus.woodstox</groupId>-->
<!-- <artifactId>stax2-api</artifactId>-->
<!-- <version>4.2.1</version>-->
<!-- </dependency>-->
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.4.6</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<jvmArgs>
<jvmArg>-Xss16m</jvmArg>
<jvmArg>-Xms1028m</jvmArg>
<jvmArg>-Xmx4096m</jvmArg>
</jvmArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.fasterxml.jackson.dataformat</pattern>
<shadedPattern>com.shaded.fasterxml.jackson.dataformat</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<finalName>uber-${project.artifactId}-${project.version}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>
7 changes: 0 additions & 7 deletions project/plugins.sbt

This file was deleted.

10 changes: 8 additions & 2 deletions src/main/scala/com/springml/spark/salesforce/BulkRelation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ case class BulkRelation(
userSchema: StructType,
sqlContext: SQLContext,
inferSchema: Boolean,
timeout: Long) extends BaseRelation with TableScan {
timeout: Long,
maxCharsPerColumn: Int,
maxColumns: Int) extends BaseRelation with TableScan {

import sqlContext.sparkSession.implicits._

Expand Down Expand Up @@ -71,12 +73,15 @@ case class BulkRelation(

// Use Csv parser to split CSV by rows to cover edge cases (ex. escaped characters, new line within string, etc)
def splitCsvByRows(csvString: String): Seq[String] = {
if (csvString == "Records not found for this query") Seq.empty
// The CsvParser interface only interacts with IO, so StringReader and StringWriter
val inputReader = new StringReader(csvString)

val parserSettings = new CsvParserSettings()
parserSettings.setLineSeparatorDetectionEnabled(true)
parserSettings.getFormat.setNormalizedNewline(' ')
parserSettings.setMaxCharsPerColumn(maxCharsPerColumn)
parserSettings.setMaxColumns(maxColumns)

val readerParser = new CsvParser(parserSettings)
val parsedInput = readerParser.parseAll(inputReader).asScala
Expand All @@ -90,7 +95,7 @@ case class BulkRelation(
val writer = new CsvWriter(outputWriter, writerSettings)
parsedInput.foreach { writer.writeRow(_) }

outputWriter.toString.lines.toList
outputWriter.toString.split("\n").toList
}

splitCsvByRows(result)
Expand All @@ -109,6 +114,7 @@ case class BulkRelation(
.option("quote", "\"")
.option("escape", "\"")
.option("multiLine", true)
.option("maxColumns", maxColumns)
.csv(csvData)
} else {
bulkAPI.closeJob(jobId)
Expand Down
Loading