Skip to content

Instantly share code, notes, and snippets.

@jeanmidevacc
Last active August 26, 2025 03:29
Show Gist options
  • Save jeanmidevacc/0f2ee863ac491afed11096936a05fd92 to your computer and use it in GitHub Desktop.
Save jeanmidevacc/0f2ee863ac491afed11096936a05fd92 to your computer and use it in GitHub Desktop.
# How to colect table versions
query = f"""
SELECT *
FROM (DESCRIBE HISTORY name_of_the_table)
WHERE timestamp >= '{start_date.strftime('%Y-%m-%d %H:%M:%S')}';
"""
# How to get a specific version
dfs_recommendations = spark.read.format("delta").option("versionAsOf", version_id).table(f"name_of_the_table")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment