Architecture and Data Blog

Thoughts about intersection of data, devops, design and software architecture

Behavior Driven Database Development

Asserting behavior of the database just like software

When Behavior Driven Development BDD was introduced, some of the key principles were

  • Requirements are behavior,
  • Provides “ubiquitous language” for analysis,
  • Acceptance criteria should be executable.
  • Design constraints should be made into executable tests.

Using rake and activerecord to generate boilerplate DB Code

Generating code that is necessary for standard code

IN many projects, there are tables which need default audit columns such as Created_By, Created_Date, Modified_By, Modified_date and other columns that need to be updated every time some actions are done against the tables and/or columns. This type of functionality can be implemented using triggers.


Database naming conventions in different environments

Allowing for change in environment configuration

In every enterprise and every project we end up having multiple environments, especially the database side of the enterprise tends to stick around for a longer period of time and has much more dependencies or application integration as opposed to application urls etc. Given this, how to name the servers, databases and schemas becomes a very important decision, do these names provide for an easy way to use the application and not make it harder or the developers to access the database.


8 Techniques for testing migration of data from legacy systems

How to use stored procedures as interface to the data

Many of the projects we end up working on are replacing existing systems with existing data either wholly or in part. In all of the above projects we end up writing data migration or data conversion code to move the data from legacy systems to the new systems. Many stake holders of the project such as business users, project managers, business analysts really care about the data conversion scripts and the quality of the conversion.

Migrations in NoSQL databases

In relational database usage the pattern of migrations is well understood and has gained widespread acceptance. Frameworks such as DBDeploy, DBMaintain, MyBatis migrations, Flyway, Liquibase, Active Record Migrations and many others. These tools allow to migrate the database and maintain the version history of the database in the database. With the rise of NoSQL Databases and their adoption in development teams we are faced with the problem of migrations in NoSQL databases.

10 node mongodb ReplicaSet on a Single Machine"

While doing evalauation of NoSQL databases, we had a 10 node riak cluster and wanted check how a similar setup would work with mongodb. So started to setup a 10 node mongodb cluster. Since this was for initial spikes, we decided to set this up on a single machine as with the other test setup using Riak. Before I explain how we setup 10 node mongodb ReplicaSet, let me talk about replica sets.

Moved my blog to octopress

Its been about a month since my blog moved to octopress, wanted to write about my experience. I had been running my blog for a some time now using Movable Type upgrading as and when new versions where released. Over time I realized that upgrading was fraught with errors as lot of steps had to be done manually. Customizing the layout was risky as there was no way to preview your changes and commit only when I was comfortable. With the release of Movable Type 6 there is no longer a free version to download.


Usage of mixed case database object names is dangerous

Just because the database allows mixed case naming, does not mean you should use it

Some versions back, Oracle would not allow to create database object names with mixed cases, even if we tried to create them, we could not. In newer versions of Oracle we can create tables, columns, indexes etc using mixed case or lower case, when the names are put inside double quotes. For example


10 node Riak cluster on a single machine

When trying to evaluate NoSQL databases, its usually better to try them out. While trying them out, its better to use them with multiple node configurations instead of running single node. Such as clusters in Riak or Replica-set in mongodb maybe even a sharded setup. On our project we evaluated a 10 node Riak cluster so that we could experiment with N, R and W values and decide which values where optimal for us.

Transactions using Groovy.SQL with Spring annotations and connection pools

When using Groovy with Spring framework, interacting with the database can be done using the Groovy.SQL class which provides a easy to use interface. When using Groovy.SQL, if we have a need to do transactions, we have the .withTransaction method that accepts a closure, to which we can pass in code to execute within the transaction. In our project since we were using spring already, using annotations to define transactions would be a great.