The ongoing development of a complex model for power grid networks, based on the Common Information Model (CIM), is dealing with design, operability and exchange of data among various power grid operators. This paper presents a methodological approach to development of a database that supports an easy storing and managing of active CIM instances, as well as their historical versions. To facilitate the implementation of the proposed approach, we apply a paradigm of automatic programming. Our code generator eases the work on developing an API communication layer over the database and allows faster response on CIM changes. Finally, we present a performance cost analysis on test models. By this, our intention is to contribute to a wider acceptance of CIM in power grid networks.