Skip to content

Commit 57cce81

Browse files
Table creation (#47)
## Summary ## Checklist - [ ] Added Unit Tests - [ ] Covered by existing CI - [x] Integration tested - [ ] Documentation update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced functionality to create a "drift_statistics" table in DynamoDB via command-line interface. - Added checks for required JAR files in the startup script to ensure proper initialization. - **Bug Fixes** - Updated user permissions for the DynamoDB service in the Docker configuration to enhance access control. - **Documentation** - Improved clarity in the startup script with new variable definitions for JAR file paths. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Chewy Shaw <[email protected]>
1 parent 675d0f7 commit 57cce81

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spark/src/main/scala/ai/chronon/spark/Driver.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,18 @@ object Driver {
579579
}
580580
}
581581

582+
object CreateStatsTable {
583+
@transient lazy val logger: Logger = LoggerFactory.getLogger(getClass)
584+
class Args extends Subcommand("create-stats-table") with OnlineSubcommand
585+
586+
def run(args: Args): Unit = {
587+
logger.info("Creating table 'drift_statistics'")
588+
val store = args.api.genKvStore
589+
val props = Map("is-time-sorted" -> "true")
590+
store.create("drift_statistics", props)
591+
}
592+
}
593+
582594
// common arguments to all online commands
583595
trait OnlineSubcommand { s: ScallopConf =>
584596
// this is `-Z` and not `-D` because sbt-pack plugin uses that for JAVA_OPTS
@@ -596,6 +608,8 @@ object Driver {
596608
map.toMap
597609
}
598610

611+
lazy val api: Api = impl(serializableProps)
612+
599613
def metaDataStore =
600614
new MetadataStore(impl(serializableProps).genKvStore, "ZIPLINE_METADATA", timeoutMillis = 10000)
601615

@@ -929,6 +943,8 @@ object Driver {
929943
addSubcommand(JoinBackfillFinalArgs)
930944
object LabelJoinArgs extends LabelJoin.Args
931945
addSubcommand(LabelJoinArgs)
946+
object CreateStatsTableArgs extends CreateStatsTable.Args
947+
addSubcommand(CreateStatsTableArgs)
932948
requireSubcommand()
933949
verify()
934950
}
@@ -968,6 +984,7 @@ object Driver {
968984
case args.LabelJoinArgs => LabelJoin.run(args.LabelJoinArgs)
969985
case args.JoinBackfillLeftArgs => JoinBackfillLeft.run(args.JoinBackfillLeftArgs)
970986
case args.JoinBackfillFinalArgs => JoinBackfillFinal.run(args.JoinBackfillFinalArgs)
987+
case args.CreateStatsTableArgs => CreateStatsTable.run(args.CreateStatsTableArgs)
971988
case _ => logger.info(s"Unknown subcommand: $x")
972989
}
973990
case None => logger.info("specify a subcommand please")

0 commit comments

Comments
 (0)