spark-sql-migrations 0.0.3__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/PKG-INFO +6 -4
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/setup.py +6 -4
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/spark_sql/spark_sql.py +7 -2
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/PKG-INFO +6 -4
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/LICENSE +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/MANIFEST.in +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/backend_shim.py +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/setup.cfg +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/__init__.py +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/migration_templates/default_migration_template.sql +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/migrations_initial/first_01_intial_create_cat_dbr_only.sql +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/migrations_initial/first_02_intial_create_schema_all.sql +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/migrations_initial/first_03_intial_create_state_table_all.sql +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/py.typed +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/spark_sql/__init__.py +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/spark_utils.py +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/SOURCES.txt +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/dependency_links.txt +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/entry_points.txt +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/namespace_packages.txt +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/requires.txt +0 -0
- {spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spark_sql_migrations
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Chained, idempotent SQL migrations for Spark and Databricks.
|
|
5
5
|
Home-page: https://github.com/mcjug2015/spark_sql_migrations
|
|
6
6
|
Author: Victor Semenov
|
|
@@ -81,10 +81,12 @@ Migrations come from two different owners, and they behave differently:
|
|
|
81
81
|
| **what** | catalog, schema, `_spark_migrations_version` table | your tables and columns |
|
|
82
82
|
| **where** | `spark_sql_migrations/migrations_initial/` | `all_spark_migrations/`, `dbr_only_migrations/` |
|
|
83
83
|
| **selected by** | filename suffix — `_all.sql` everywhere, `_dbr_only.sql` on Databricks | the `prev_revision_id` chain |
|
|
84
|
-
| **when applied** |
|
|
84
|
+
| **when applied** | until the version table exists | once, then recorded |
|
|
85
85
|
|
|
86
|
-
The bootstrap chain is
|
|
87
|
-
|
|
86
|
+
The bootstrap chain is applied on every run until `_spark_migrations_version` exists, and
|
|
87
|
+
skipped from then on. A run that fails partway through bootstrapping replays it, so it must
|
|
88
|
+
still be idempotent. Your own chains are applied once each and their head revision is
|
|
89
|
+
written to the version table.
|
|
88
90
|
|
|
89
91
|
## Laying out your chains
|
|
90
92
|
|
|
@@ -82,10 +82,12 @@ Migrations come from two different owners, and they behave differently:
|
|
|
82
82
|
| **what** | catalog, schema, `_spark_migrations_version` table | your tables and columns |
|
|
83
83
|
| **where** | `spark_sql_migrations/migrations_initial/` | `all_spark_migrations/`, `dbr_only_migrations/` |
|
|
84
84
|
| **selected by** | filename suffix — `_all.sql` everywhere, `_dbr_only.sql` on Databricks | the `prev_revision_id` chain |
|
|
85
|
-
| **when applied** |
|
|
85
|
+
| **when applied** | until the version table exists | once, then recorded |
|
|
86
86
|
|
|
87
|
-
The bootstrap chain is
|
|
88
|
-
|
|
87
|
+
The bootstrap chain is applied on every run until `_spark_migrations_version` exists, and
|
|
88
|
+
skipped from then on. A run that fails partway through bootstrapping replays it, so it must
|
|
89
|
+
still be idempotent. Your own chains are applied once each and their head revision is
|
|
90
|
+
written to the version table.
|
|
89
91
|
|
|
90
92
|
## Laying out your chains
|
|
91
93
|
|
|
@@ -252,5 +254,5 @@ Apache License 2.0 — see [LICENSE](LICENSE).
|
|
|
252
254
|
},
|
|
253
255
|
'python_requires': '>=3.10',
|
|
254
256
|
'url': 'https://github.com/mcjug2015/spark_sql_migrations',
|
|
255
|
-
'version': '0.0.
|
|
257
|
+
'version': '0.0.4',
|
|
256
258
|
})
|
|
@@ -5,7 +5,8 @@ Two kinds of migration exist, and they are owned by different parties:
|
|
|
5
5
|
* the *initial* chain and the new-migration template ship inside this package.
|
|
6
6
|
They bootstrap the catalog, the schema and the version table, are selected by
|
|
7
7
|
filename suffix (``_all.sql`` / ``_dbr_only.sql``) rather than by revision,
|
|
8
|
-
and are
|
|
8
|
+
and are applied on every run until the version table exists -- so a run that
|
|
9
|
+
failed partway through replays them, and they must be idempotent.
|
|
9
10
|
* the ``all_spark_migrations/`` and ``dbr_only_migrations/`` chains belong to
|
|
10
11
|
the consuming project. The caller passes their parent directory as
|
|
11
12
|
``migrations_root``; each chain is walked from its root via
|
|
@@ -288,7 +289,11 @@ def run_migrations(spark, cat, schema, output_folder, migrations_root):
|
|
|
288
289
|
os.makedirs(initial_output_folder, exist_ok=True)
|
|
289
290
|
os.makedirs(dbr_ouput_folder, exist_ok=True)
|
|
290
291
|
os.makedirs(all_spark_ouput_folder, exist_ok=True)
|
|
291
|
-
|
|
292
|
+
version_table = f"{cat}.{schema}.{VERSION_TABLE}"
|
|
293
|
+
if spark.catalog.tableExists(version_table):
|
|
294
|
+
logger.info(f"{version_table} already exists; skipping the initial migrations;")
|
|
295
|
+
else:
|
|
296
|
+
migrate_initial(spark, initial_output_folder, cat, schema)
|
|
292
297
|
if is_dbr():
|
|
293
298
|
migrate_w_rev(spark, dbr_ouput_folder, migrations_root, cat, schema, DBR_ONLY)
|
|
294
299
|
migrate_w_rev(spark, all_spark_ouput_folder, migrations_root, cat, schema, ALL_SPARK)
|
{spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spark_sql_migrations
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Chained, idempotent SQL migrations for Spark and Databricks.
|
|
5
5
|
Home-page: https://github.com/mcjug2015/spark_sql_migrations
|
|
6
6
|
Author: Victor Semenov
|
|
@@ -81,10 +81,12 @@ Migrations come from two different owners, and they behave differently:
|
|
|
81
81
|
| **what** | catalog, schema, `_spark_migrations_version` table | your tables and columns |
|
|
82
82
|
| **where** | `spark_sql_migrations/migrations_initial/` | `all_spark_migrations/`, `dbr_only_migrations/` |
|
|
83
83
|
| **selected by** | filename suffix — `_all.sql` everywhere, `_dbr_only.sql` on Databricks | the `prev_revision_id` chain |
|
|
84
|
-
| **when applied** |
|
|
84
|
+
| **when applied** | until the version table exists | once, then recorded |
|
|
85
85
|
|
|
86
|
-
The bootstrap chain is
|
|
87
|
-
|
|
86
|
+
The bootstrap chain is applied on every run until `_spark_migrations_version` exists, and
|
|
87
|
+
skipped from then on. A run that fails partway through bootstrapping replays it, so it must
|
|
88
|
+
still be idempotent. Your own chains are applied once each and their head revision is
|
|
89
|
+
written to the version table.
|
|
88
90
|
|
|
89
91
|
## Laying out your chains
|
|
90
92
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/spark_sql/__init__.py
RENAMED
|
File without changes
|
{spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations/spark_utils.py
RENAMED
|
File without changes
|
{spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spark_sql_migrations-0.0.3 → spark_sql_migrations-0.0.4}/spark_sql_migrations.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|