Advertisement
NLinker

Test two step rename

Feb 21st, 2018
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.88 KB | None | 0 0
  1. package com.vertigo.mapping.persistence
  2.  
  3. import com.typesafe.config.ConfigFactory
  4. import com.vertigo.mapping.persistence.MappingToResolver.{BaseTn, GenTnf, TempTn}
  5. import com.vertigo.mapping.persistence.sql.SqlMetaUtils
  6.  
  7. object Test extends App {
  8.  
  9.   val config = ConfigFactory.parseString(
  10.     """
  11.      |jdbc {
  12.      |  host = "localhost"
  13.      |  port = 5432
  14.      |  database = "vertigo_resolver_service_db"
  15.      |  username = "postgres"
  16.      |  password = "postgres"
  17.      |  batchSize = 5000
  18.      |}
  19.    """.stripMargin)
  20.   val dataSource = Utils.createDataSource(config)
  21.  
  22.   val (sql1, sql2) = SqlMetaUtils.buildTwoStepRenames(dataSource,
  23.     BaseTn("spotify_mapping"),
  24.     TempTn("spotify_mapping_temp"),
  25.     GenTnf("spotify_mapping_" + _)
  26.   )
  27.  
  28.   println(sql1)
  29.   println(sql2)
  30.  
  31.   //Utils.executeUpdate(dataSource, sql1)
  32.   //Utils.executeUpdate(dataSource, sql2)
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement