diff --git a/pramen/core/src/main/scala/za/co/absa/pramen/core/bookkeeper/BookkeeperDeltaTable.scala b/pramen/core/src/main/scala/za/co/absa/pramen/core/bookkeeper/BookkeeperDeltaTable.scala index a5b0ca25f..b93289600 100644 --- a/pramen/core/src/main/scala/za/co/absa/pramen/core/bookkeeper/BookkeeperDeltaTable.scala +++ b/pramen/core/src/main/scala/za/co/absa/pramen/core/bookkeeper/BookkeeperDeltaTable.scala @@ -100,8 +100,8 @@ class BookkeeperDeltaTable(database: Option[String], } private def initSchemasDirectory(): Unit = { - if (!spark.catalog.tableExists(schemasTable)) { - writeEmptyDataset[TableSchemaJson](schemasTable) + if (!spark.catalog.tableExists(schemasFullTableName)) { + writeEmptyDataset[TableSchemaJson](schemasFullTableName) } } } diff --git a/pramen/core/src/test/scala/za/co/absa/pramen/core/tests/bookkeeper/BookkeeperDeltaTableLongSuite.scala b/pramen/core/src/test/scala/za/co/absa/pramen/core/tests/bookkeeper/BookkeeperDeltaTableLongSuite.scala index 7b3748c03..66de740be 100644 --- a/pramen/core/src/test/scala/za/co/absa/pramen/core/tests/bookkeeper/BookkeeperDeltaTableLongSuite.scala +++ b/pramen/core/src/test/scala/za/co/absa/pramen/core/tests/bookkeeper/BookkeeperDeltaTableLongSuite.scala @@ -43,6 +43,13 @@ class BookkeeperDeltaTableLongSuite extends BookkeeperCommonSuite with SparkTest val rndInt = Math.abs(Random.nextInt()) getBookkeeper(s"tbl${rndInt}_") } + + "test tables are created properly" in { + getBookkeeper(s"tbl0000_") + + assert(spark.catalog.tableExists("tbl0000_bookkeeping")) + assert(spark.catalog.tableExists("tbl0000_schemas")) + } } private def cleanUpWarehouse(): Unit = {