{"id":46604,"date":"2020-06-09T00:00:00","date_gmt":"2020-06-09T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/griddb-schema-modification\/"},"modified":"2025-11-13T12:54:56","modified_gmt":"2025-11-13T20:54:56","slug":"griddb-schema-modification","status":"publish","type":"post","link":"https:\/\/www.griddb.net\/en\/blog\/griddb-schema-modification\/","title":{"rendered":"GridDB Schema Modification"},"content":{"rendered":"<p>We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true: there is a column that you never use and it&#8217;s taking up space. Schema flexibility is a major differentiator between NoSQL databases, with some databases having a fixed schema and other databases allowing every record to have a different schema. GridDB sits somewhere in the middle, having a fixed schema that is easily altered. <\/p>\n<p>For this post, we&#8217;re going to use the schema definition from our last blog post, <a href=https:\/\/griddb.net\/en\/blog\/geospatial-analysis-of-nyc-crime-data-with-griddb\/>Geospatial Analysis of NYC Crime Data with GridDB<\/a>.<\/p>\n<h2>Viewing a Container&#8217;s Schema<\/h2>\n<p>Modifying the schema of a container requires you to fetch the ContainerInfo and ContainerColumnList objects which will then be modified and written back to the container. Thus, the place to start is displaying the ContainerColumnList. <\/p>\n<pre>\nContainerInfo conInfo = store.getContainerInfo(\"COMPLAINTS\");\nList<ColumnInfo> newColumnList = new ArrayList<ColumnInfo>();\nfor ( int i = 0; i < conInfo.getColumnCount(); i++ ){\n        System.out.println(conInfo.getColumnInfo(i).getName());\n}\n<\/pre>\n<h2>Adding a Column<\/h2>\n<p>You can use any Java List method of adding a row. In this example, we append an Address to the schema. This is actually a real world example in schema modification: we were storing latitude and longitude in GridDB and after years of collecting data, we also wanted to store the GeoCoded information about that point. <\/p>\n<pre>\nContainerInfo conInfo = store.getContainerInfo(\"COMPLAINTS\");\nList<ColumnInfo> newColumnList = new ArrayList<ColumnInfo>();\nfor ( int i = 0; i < conInfo.getColumnCount(); i++ ){\n    newColumnList.add(conInfo.getColumnInfo(i));\n}\n\nnewColumnList.add(new ColumnInfo(\"ADDRESS\", GSType.STRING));\nconInfo.setColumnInfoList(newColumnList);\nstore.putCollection(\"COMPLAINTS\", conInfo, true);\n<\/pre>\n<h2>Removing a Column<\/h2>\n<p>Like adding data, the Java List API can be used to remove a ColumnInfo row from the Column List. Since we're making a copy of the data, the newColumnList can be altered during the copy as follows:<\/p>\n<pre>\nContainerInfo conInfo = store.getContainerInfo(\"COMPLAINTS\");\nList<ColumnInfo> newColumnList = new ArrayList<ColumnInfo>();\nfor ( int i = 0; i < conInfo.getColumnCount(); i++ ){\n    if(!conInfo.getColumnInfo(i).getName().equals(\"VIC_AGE_GROUP\"))\n        newColumnList.add(conInfo.getColumnInfo(i));\n}\n\nconInfo.setColumnInfoList(newColumnList);\nstore.putCollection(\"COMPLAINTS\", conInfo, true);\n<\/pre>\n<p>The entire Java program for the displaying, adding, and removing of columns can be downloaded <a href=\"https:\/\/griddb.net\/en\/download\/26615\/\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true: there is a column that you never use and it&#8217;s taking up space. Schema flexibility is a major differentiator between NoSQL databases, with some databases having a [&hellip;]<\/p>\n","protected":false},"author":71,"featured_media":26617,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46604","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GridDB Schema Modification | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true:\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GridDB Schema Modification | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true:\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-09T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:54:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.griddb.net\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1677\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Owen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Owen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\"},\"author\":{\"name\":\"Owen\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/0f2f6d4b593adde8c43cf3ea5c794c66\"},\"headline\":\"GridDB Schema Modification\",\"datePublished\":\"2020-06-09T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:54:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\"},\"wordCount\":266,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\",\"url\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\",\"name\":\"GridDB Schema Modification | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png\",\"datePublished\":\"2020-06-09T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:54:56+00:00\",\"description\":\"We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true:\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png\",\"contentUrl\":\"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png\",\"width\":1920,\"height\":1677},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb.net\/en\/#website\",\"url\":\"https:\/\/griddb.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/0f2f6d4b593adde8c43cf3ea5c794c66\",\"name\":\"Owen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/47438a5c81215c7a9043be1b427e0bbd8dc0f77bd536f147f8495575149e4325?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/47438a5c81215c7a9043be1b427e0bbd8dc0f77bd536f147f8495575149e4325?s=96&d=mm&r=g\",\"caption\":\"Owen\"},\"url\":\"https:\/\/www.griddb.net\/en\/author\/owen\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GridDB Schema Modification | GridDB: Open Source Time Series Database for IoT","description":"We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true:","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/","og_locale":"en_US","og_type":"article","og_title":"GridDB Schema Modification | GridDB: Open Source Time Series Database for IoT","og_description":"We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true:","og_url":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2020-06-09T07:00:00+00:00","article_modified_time":"2025-11-13T20:54:56+00:00","og_image":[{"width":1920,"height":1677,"url":"https:\/\/www.griddb.net\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png","type":"image\/png"}],"author":"Owen","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"Owen","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#article","isPartOf":{"@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/"},"author":{"name":"Owen","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/0f2f6d4b593adde8c43cf3ea5c794c66"},"headline":"GridDB Schema Modification","datePublished":"2020-06-09T07:00:00+00:00","dateModified":"2025-11-13T20:54:56+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/"},"wordCount":266,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/","url":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/","name":"GridDB Schema Modification | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png","datePublished":"2020-06-09T07:00:00+00:00","dateModified":"2025-11-13T20:54:56+00:00","description":"We all try to plan for the future when designing our data schema, but inevitably a new feature requires adding a column. The inverse can also be true:","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/blog\/griddb-schema-modification\/#primaryimage","url":"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png","contentUrl":"\/wp-content\/uploads\/2020\/05\/database-schema-1895779.png","width":1920,"height":1677},{"@type":"WebSite","@id":"https:\/\/griddb.net\/en\/#website","url":"https:\/\/griddb.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/0f2f6d4b593adde8c43cf3ea5c794c66","name":"Owen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/47438a5c81215c7a9043be1b427e0bbd8dc0f77bd536f147f8495575149e4325?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/47438a5c81215c7a9043be1b427e0bbd8dc0f77bd536f147f8495575149e4325?s=96&d=mm&r=g","caption":"Owen"},"url":"https:\/\/www.griddb.net\/en\/author\/owen\/"}]}},"_links":{"self":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/comments?post=46604"}],"version-history":[{"count":1,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46604\/revisions"}],"predecessor-version":[{"id":51289,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46604\/revisions\/51289"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media\/26617"}],"wp:attachment":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}