You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/04/02 10:01:15 UTC

[GitHub] [iceberg] openinx commented on pull request #2410: Flink: Support SQL primary key

openinx commented on pull request #2410:
URL: https://github.com/apache/iceberg/pull/2410#issuecomment-812463051


   If we want to sync deletions from mysql binlog into apache iceberg table, then we will need to upgrade the iceberg table from version 1 to version 2 by following code as we don't expose the v2 to end users now. 
   
   ```java
   import java.util.Map;
   import org.apache.hadoop.conf.Configuration;
   import org.apache.iceberg.BaseTable;
   import org.apache.iceberg.Table;
   import org.apache.iceberg.TableMetadata;
   import org.apache.iceberg.TableOperations;
   import org.apache.iceberg.catalog.TableIdentifier;
   import org.apache.iceberg.relocated.com.google.common.collect.Maps;
   
   public class TestIceberg {
   
     private TestIceberg() {
     }
   
     public static void main(String[] args) {
   
       Map<String, String> properties = Maps.newHashMap();
       properties.put("type", "iceberg");
       properties.put("catalog-type", "hive");
       properties.put("uri", "thrift://localhost:9083");
       properties.put("clients", "5");
       properties.put("property-version", "1");
       properties.put("warehouse", "file:///Users/openinx/test/iceberg-warehouse");
   
       CatalogLoader loader = CatalogLoader.hive("hive_catalog", new Configuration(), properties);
       Table table = loader.loadCatalog().loadTable(TableIdentifier.of("mysql_db", "iceberg_sbtest1"));
   
       TableOperations ops = ((BaseTable) table).operations();
       TableMetadata meta = ops.current();
       ops.commit(meta, meta.upgradeToFormatVersion(2));
     }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org