rakesh-das08 commented on issue #8881:
URL: https://github.com/apache/iceberg/issues/8881#issuecomment-1775511123

   Few observations: 
   1) There are 2 ways to work with branches: WAP or Branch Identifiers. IMO 
working with branch identifiers is much intuitive and easier. You can refer to 
a branch by using `db.table.branch_<your_branch_name>`
   So once you use branch identifiers, you dont need to set `spark.wap.branch = 
'validation-branch'`
   
   2) So if you are using branch identifiers, your merge and insert query can 
be re-written as below:
   ```
   spark.sql(f"""
   MERGE INTO iceberg_catalog.db.employee as T
   USING 
       iceberg_catalog.db.employee_stg as S
   ON T.employee_id = S.employee_id
   WHEN MATCHED and etl_state = 'current'
   THEN UPDATE 
       SET etl_state='history',
           eff_end_dt=S.load_date
   """)
   spark.sql(f"""
   INSERT INTO iceberg_catalog.db.employee
   select  employee_id, name, salary, load_date, date('9999-12-31'), 'current'
   from iceberg_catalog.db.employee_stg
   """)
   ```
   
   3) Your `fast_forward` procedure seems to be using a different schema and 
table than the ones defined above.
   So your `fast_forward` procedure call should look something like :
   ```
   spark.sql("""CALL 
iceberg_catalog.system.fast_forward('iceberg_catalog.db.employee', 'main', 
'validation-branch')""")
   ```
   
   Note: Please use `_` (underscore) while naming the branch. For eg: 
`validation_branch`.
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

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


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

Reply via email to