SQL Server OUTPUT clause alternative
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 03:50 AM
I am looking at after a merge or insert has happened to get the records in that batch that had been inserted via either method, much like the OUTPUT clause in sql server.
Does anyone have any suggestions, the only thing I can think of is to add a timestamp to the records and then select them from the table, however that would require having a timestamp on all tables I have.
Thanks
Labels:
- Labels:
-
Spark
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 02:35 AM
I've managed to do it like this
qry = spark.sql(f"DESCRIBE history <table_name> limit 1").collect()
current_version = int(qry[0][0])
prev_version = current_version - 1
Then do an except statement between the versions.

