An admin screen with three columns for development, test and production. On development the change Revenue by region appears with a view, a function and a table, with a line to the earlier change it depends on. After a click on Install on TEST the package slides into the test column and gets a tick, after which a check line shows three of three dependencies found and the package lands on production with a tick.

From change to production: deploying per change instead of the whole environment

Joris, the wholesaler's controller, wants a revenue overview by region. To build it, data engineer Sanne creates one view on the development environment, with a helper function and a small region table. Those three parts have to go to test and then to production. The other 340 tables in the data warehouse have to stay as they are.

In Yres you pack such an adjustment as one change, together with everything it depends on. You lock that change and install it from the admin screen, first on test and then on production. Below you follow that one change from start to finish, including the moment an install fails halfway.

Published: · Last updated: · By , architect of Yres and founder of Plainwater

What is deploying per change?

Deploying per change means you move only the package with one adjustment to another environment. The rest of that environment stays as it is.

The wholesaler works with three environments: development, test and production. The rule is simple: you build only on development and nobody edits anything directly on production.

Sanne's view reads the history table with customers from the accounting package. For the region she uses a helper function that derives the region from the postcode. That function relies on a region table of 40 rows that Sanne fills herself.

In an ordinary database project she would now redeploy the whole database or copy the scripts to test by hand. In Yres everything Sanne does on development is automatically booked under a change. That change in turn belongs to a project. Here the project is called Reporting Q4 and the change Revenue by region. The change is the unit that will travel.

If an organisation has only one environment, there is nothing to transport and changes apply immediately. The section with projects and changes then does not appear in the admin screen. The rest of this article is about organisations with several environments.

What is in a change?

A change contains the parts you add, plus the parts they depend on. Loaded data, credentials and the engine itself never travel.

Sanne opens the object tree of the database in the admin screen. She right-clicks her view and chooses add to change, with dependencies. Yres then walks the dependencies of the view, so the helper function and the region table come along. For a table of your own, Yres asks whether the content should come along too. Sanne confirms that for the region table.

The customer table is a different story. It is managed by Yres itself and has been on all environments for months. It got there through the change that connected the accounting package. So Yres does not include the table again. It records that this change depends on that earlier change.

What Yres stores per part differs:

  • A view or function. Yres stores the definition as it stands on development.
  • A table that Yres manages. Yres stores no script, only the metadata: the columns, the key, the load mode, the delta column and the data types. The target environment builds the table from that itself and loads it from its own source.
  • A table of your own. Yres stores the definition, with the content included if you choose so.

Three things never travel:

  • The loaded data. The history tables stay where they are. Test loads its own customers from its own accounting package.
  • Source credentials. These live per environment in the key vault.
  • The Yres engine. Every environment receives the engine through a version upgrade.

What does travel gets the right name on the way. A source that carries a development name on development is called something else on test and production. Translation rules per environment make sure the same change touches the right physical objects everywhere.

Before Sanne goes on, she reviews the content of the change. The admin screen shows it as a tree, from source through schema to table. She can also pick a table view with, per object, the load mode, the delta column and what happens when the object already exists on the target. A separate link shows which other changes this one depends on, with their status.

PartTravelsHow
The revenue viewYesAs a definition, in the version that stands on development at the moment of locking
The helper functionYes, as a dependencyIncluded automatically with add with dependencies
The region table (own table)Yes, content optionalThe definition always, the 40 rows only if Sanne ticks that box
The customer table from the accounting packageNot againSits in an earlier change, to which this change refers as a dependency
The loaded data in the history tablesNoEvery environment loads itself, from its own source
Source credentialsNoLive per environment in the key vault
The Yres engine itselfNoComes through a version upgrade, separate from this process

Step by step from development to production

First Sanne locks the change. On the changes screen she opens the action menu and chooses release. Yres then checks three things:

  • Content. An empty change cannot be released.
  • Status. The change must still be open.
  • Dependencies. Every change this one depends on must already be released. If not, Yres blocks the release with a message that names the changes that have to go first.

Yres then collects the current version of every part again. Next the change is locked and nobody can alter it any more. Yres freezes the whole as one package: the header, the project, the parts with their scripts and the dependencies.

Then test. In the same action menu Sanne picks the test environment and clicks install. What follows happens in five steps:

  1. Version check. Development and test must run the same Yres version. If they do not, it stops here with the message that the versions do not match. The environment that is behind has to be updated first.
  2. Registration. The package is registered on test, without anything being applied yet. A package whose parts refer to a different change is refused. So is a package that collides with a number already in use on test. Nothing is registered then, but the attempt does stay in the log.
  3. Scripts. Yres generates a script per part, in the order in which the parts were added to the change. An existing view or function is removed first and then created again. For a table that Yres manages, the metadata goes into the records of test first. Then the physical table is created or adjusted. The translation rules adjust the names.
  4. Queue. If a part fails because something it relies on does not exist yet, it goes into a queue. Yres retries that queue after every part that succeeds, until nothing more is added. The order within a change thus resolves itself, even if the view came before the function.
  5. Pipelines. Finally the pipelines are published to the test environment again. That continues in the background while the screen shows a progress notice.

On the changes screen Sanne sees an indicator per environment: green where the step is done, grey where it is not. A column with the next step suggests what should happen now, in this case install on production.

The next morning, after the nightly load on test, Joris checks the revenue overview. Bakkerij Ter Horst counts in the Zwolle region until 2 October and in the Deventer region after that. He approves. Sanne picks production in the same menu and clicks install again, with the same checks and the same package. The wholesaler's 340 other tables have not been touched.

What happens when an install fails halfway?

The parts that succeed stay in place. Whatever fails stays in the queue and goes into the log with the database's error message.

A few weeks later Sanne builds a second view, margin by region. It relies on a cost price table from the planning package. Her colleague Rutger added that table in a change of his own, Planning tables. That change has been released and installed on test, though not yet on production.

Sanne releases her change. That works, because the change she depends on has been released. The install on test goes through without trouble as well. Then production.

At the start of the install Yres sees that a change this one depends on has no successful install on production yet. It writes a warning with the name of that change in the log. Still the install continues, because Yres enforces the order between changes at release time and only warns at install time.

The helper function of the margin view is created. The view itself fails because the cost price table does not exist on production. It goes into the queue, but nothing that succeeds afterwards changes that. The install ends with the view still in the queue.

The log holds, per failed part, the database's error message and the script Yres tried. Yres also records that this install failed, by whom and when. The background task that ran the install writes a failed status into the log that the monitoring screen reads.

So production now has the helper function but not the view. An install is not an all-or-nothing transaction over the whole package. Per part it sometimes is. A table that changes structure is rebuilt in one transaction, including moving the existing rows across. If that fails, the old table is still there as it was.

The fix here is simple. Rutger installs Planning tables on production. Sanne then chooses reinstall in her action menu. The package does not have to be registered again, the view is created and the install now stands as succeeded.

There is one more case. Sometimes Yres cannot build the scripts themselves, for instance because the metadata of a part is damaged. It then runs nothing at all, so no half package lands on production. The error is in the log and the install waits until the cause has been removed.

When do you use it?

Deploying per change is meant for what the customer builds on top of the engine: your own views, functions, procedures and tables, new source tables and removals. Three cases keep coming back in practice.

A new reporting view on existing tables. That is Sanne's story. The view, the function and the region table travel together. The customer table they rely on is already everywhere.

A new table from a package that is already connected. After an update the planning package gains a table with delivery routes. Rutger adds it on development, loads it and checks it. The change contains only metadata: columns, key and load mode. Test and production create the table themselves and load it from their own planning package, without a line of code being involved.

Removing something. Nobody uses an old view any more. In the object tree Sanne chooses delete through a change. Yres first checks which objects still depend on it. If there are any, it is not allowed. If there are none, the removal is recorded and the view disappears on every environment when that change is installed.

The Yres engine itself, with the procedures and tables Yres ships, never travels inside a change. It arrives separately through a version upgrade. How that works is covered in our article on upgrading without losing your tables.

Where it stops

  • Data does not travel, because every environment loads from its own source
  • Dependencies follow what the database itself knows about references. A reference inside dynamically built SQL stays out of sight
  • The order between changes is enforced at release time. At install time it remains a warning
  • On a reinstall an existing view or function is removed first. If the recreation then fails, the old version is gone until you fix it
  • With one environment there is no process, because changes then apply immediately

Frequently asked questions

Why not just a DACPAC or a Git pipeline, like any other database project?

You can, because the Yres engine itself is deployed that way: as a database project, followed by a publication of the pipelines. Deploying per change is for what the customer builds on top of it, by people who do not want to run a release pipeline. A change collects itself while you work and translates names per environment. Anyone who already has a well-running release pipeline for their own objects does not have to throw it away. For tables that Yres manages the change is the only route, because no script exists for them.

Can I take the content of my own table along to test and production?

Yes, you choose that when adding it to the change. For a small reference table such as the region table that is useful. For a table with millions of rows it is not a good idea.

I adjusted the view after the release. What now?

That adjustment is not in the package, because the change is locked. You create a new change for it. If you adjust the view between adding it and releasing, the latest version does travel, because Yres collects everything again at release.

Can I see afterwards which changes touched an object?

Yes. The object tree shows per object which changes touched it. Through the action menu you open the log of every registration and install, step by step. For every install Yres records who did it, when and with what outcome.

Talk to a data architect

In 30 minutes a data architect looks at your current data environment with you and at where it pinches today.

Book a call →

Further reading

Data warehouse automation that runs in your own Azure

Built for organisations on Azure and Power BI. Yres connects your sources, keeps the history and promotes changes in a controlled way, without manual work.