Working with COU data
All AddressBase products are available as a full supply or a Change Only Update (COU).
A COU means you will only be supplied with the features which have changed since your last supply.
The following sub-sections provide guidance on how you could potentially manage a COU supply of AddressBase Core using PostgreSQL.
Where angle brackets (<>) are used, you should be replace the entire string with your content. For example:
Becomes:
If referencing a schema, <schema_name>, can be placed in front of any <table_name>, for example:
Types of change
At a high level, there are three types of change found within COU:
Deletes (CHANGE_TYPE ‘D’) are objects that have ceased to exist in the product since the last product refresh.
Inserts (CHANGE_TYPE ‘I’) are objects that have been newly inserted into the product since the last product refresh.
Updates (CHANGE_TYPE ‘U’) are objects that have been updated in the product since the last product refresh.
High-level COU implementation model
High-level COU implementation model with archiving
Before a COU is applied, there may be a business requirement to archive existing address records. The diagram below shows how to implement archiving with an AddressBase Core COU within a database.
Applying COU to tables
Within AddressBase Core there will be no records with the same UPRN. You can test this by checking the number of records that have the same UPRN. The following SQL query notifies you of any duplicates.
This query should return 0 rows, and this confirms that there are no duplicates. As there are no duplicate records, we can use the UPRN to apply the COU.
With archiving
Where there is a business requirement to keep the records that are being Updated and Deleted in a separate archive table, the following SQL will create an Archive Table. It will populate with records that are being Updated and Deleted from the live AddressBase Core table.
The following commands create an archive table of the records that are being updated and deleted from the existing table, for example, addressbase_core_archive
.
Use the steps in Working with CSV data > Loading AddressBase Core into a database to load the COU CSV into a new or existing table, for example,
addressbase_core_cou
.If this table already exists, you can use
INSERT INTO <
abcore_archive_table_name
>
, rather thanCREATE TABLE <
abcore_archive_table_name
> AS
.The following commands deletes the records from the existing table, which are either updates or deletions.
The following command inserts the new insert records and the new updated records into the live BLPU table.
You can check that this has been successful by re-checking that there are no duplicate UPRNs.
Without archiving
If there is no requirement for archiving, follow these steps:
Use the steps in Working with CSV data > Loading AddressBase Core into a database to load the COU CSV into a new or existing table, for example,
addressbase_core_cou
.Now, delete the existing records that will be updated, for example, Updates and Deletions.
Insert the new updated records.
You can check that this has been successful by re-checking that there are no duplicate UPRNs.
Last updated