truncate
Draft in Progress
This document is a draft and is under development.
Description
- Removes all data from a database table.
Attributes
- >> REF:
target: - >> TYPE: string - - > REQUIRED
connection-id: - >> TYPE: string
schema: - >> TYPE: string
mode: - >> TYPE: string
Examples
Prerequisites
etlunit-core
dependency in POM.etlunit-database
dependency in POM.- This dependency may be secondary.
- For instance, if you declare a dependency on
etlunit-sql-server-database
, Maven will import theetlunit-database
dependency for you.
<dependencies> <dependency> <groupId>org.bitbucket.bradleysmithllc.etlunit</groupId> <artifactId>etlunit-core</artifactId> <version>${etlunit.project.version}</version> </dependency> <dependency> <groupId>org.bitbucket.bradleysmithllc.etlunit</groupId> <artifactId>etlunit-database</artifactId> <version>${etlunit.project.version}</version> </dependency> </dependencies>
Simplest truncate()
Example
@Database(id: 'qpt_pet', modes: ['src'])
class truncate_operation
{
@Test
truncateDemoBareEssentials()
{
stage(
source: 'BUCKET_GAP_FILLER_FF_SIMPL_TRUNC',
connection-id:'qpt_pet',
target-table: 'BUCKET'
);
assert(
source-table: 'BUCKET',
connection-id:'qpt_pet',
assertion-mode: 'notEmpty'
);
truncate(
target: 'BUCKET'
);
assert(
source-table: 'BUCKET',
connection-id:'qpt_pet',
assertion-mode: 'empty'
);
}
}
Example of truncate()
showing all possible properties
@Database(id: 'qpt_pet', modes: ['src'])
class truncate_operation
{
@Test
truncateDemoAll()
{
stage(
source: 'BUCKET_GAP_FILLER_FF_SIMPL_TRUNC',
connection-id:'qpt_pet',
target-table: 'BUCKET'
);
assert(
source-table: 'BUCKET',
connection-id:'qpt_pet',
assertion-mode: 'notEmpty'
);
truncate(
target: 'BUCKET',
connection-id: 'qpt_pet',
schema: 'dbo',
mode: 'src'
);
assert(
source-table: 'BUCKET',
connection-id:'qpt_pet',
assertion-mode: 'empty'
);
}
}