-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
limit support added to test anonymization
- Loading branch information
1 parent
4e821db
commit 1cb4de0
Showing
7 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/github/dataanon/strategies/DefaultDoubleStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.github.dataanon.strategies | ||
|
||
import com.github.dataanon.Field | ||
import com.github.dataanon.Record | ||
|
||
class DefaultDoubleStrategy(private val value: Double = 4.2) : AnonymizationStrategy { | ||
override fun anonymize(field: Field, record: Record): Any { | ||
return value | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/kotlin/com/github/dataanon/20MPostgresWhitelist.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.github.dataanon | ||
|
||
import com.github.dataanon.dsl.Whitelist | ||
import com.github.dataanon.strategies.DefaultDoubleStrategy | ||
|
||
/** | ||
* CREATE TABLE RATINGS_A(USERID INTEGER, MOVIEID INTEGER,RATING NUMERIC,TIMESTAMP BIGINT, PRIMARY KEY(USERID, MOVIEID)) | ||
*/ | ||
fun main(args: Array<String>) { | ||
val source = hashMapOf("url" to "jdbc:postgresql://localhost:5432/movies", "user" to "sunitparekh", "password" to "" | ||
, "limit" to 100000 | ||
) | ||
val dest = hashMapOf("url" to "jdbc:postgresql://localhost:5432/moviesdest", "user" to "sunitparekh", "password" to "") | ||
|
||
|
||
Whitelist(source,dest) | ||
.table("RATINGS_A") { | ||
whitelist("MOVIEID","USERID","TIMESTAMP") | ||
anonymize("RATING").using(DefaultDoubleStrategy(4.3)) | ||
} | ||
.execute() | ||
} |