fabricks 3.0.5.2__py3-none-any.whl → 3.0.6__py3-none-any.whl

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.
Files changed (139) hide show
  1. fabricks/api/__init__.py +2 -0
  2. fabricks/api/context.py +1 -2
  3. fabricks/api/deploy.py +3 -0
  4. fabricks/api/job_schema.py +2 -2
  5. fabricks/api/masks.py +3 -0
  6. fabricks/api/notebooks/initialize.py +2 -2
  7. fabricks/api/notebooks/process.py +2 -2
  8. fabricks/api/notebooks/run.py +2 -2
  9. fabricks/api/notebooks/schedule.py +75 -0
  10. fabricks/api/notebooks/terminate.py +2 -2
  11. fabricks/api/schedules.py +2 -16
  12. fabricks/cdc/__init__.py +2 -2
  13. fabricks/cdc/base/__init__.py +2 -2
  14. fabricks/cdc/base/_types.py +9 -2
  15. fabricks/cdc/base/configurator.py +86 -41
  16. fabricks/cdc/base/generator.py +44 -35
  17. fabricks/cdc/base/merger.py +16 -14
  18. fabricks/cdc/base/processor.py +232 -144
  19. fabricks/cdc/nocdc.py +8 -7
  20. fabricks/cdc/templates/{query → ctes}/base.sql.jinja +7 -6
  21. fabricks/cdc/templates/ctes/current.sql.jinja +28 -0
  22. fabricks/cdc/templates/ctes/deduplicate_hash.sql.jinja +32 -0
  23. fabricks/cdc/templates/ctes/deduplicate_key.sql.jinja +31 -0
  24. fabricks/cdc/templates/{query → ctes}/rectify.sql.jinja +4 -22
  25. fabricks/cdc/templates/ctes/slice.sql.jinja +1 -0
  26. fabricks/cdc/templates/filter.sql.jinja +4 -4
  27. fabricks/cdc/templates/macros/bactick.sql.jinja +1 -0
  28. fabricks/cdc/templates/macros/hash.sql.jinja +18 -0
  29. fabricks/cdc/templates/merge.sql.jinja +3 -2
  30. fabricks/cdc/templates/merges/nocdc.sql.jinja +41 -0
  31. fabricks/cdc/templates/queries/context.sql.jinja +186 -0
  32. fabricks/cdc/templates/{query/nocdc.sql.jinja → queries/nocdc/complete.sql.jinja} +1 -1
  33. fabricks/cdc/templates/queries/nocdc/update.sql.jinja +35 -0
  34. fabricks/cdc/templates/{query → queries}/scd1.sql.jinja +2 -28
  35. fabricks/cdc/templates/{query → queries}/scd2.sql.jinja +29 -48
  36. fabricks/cdc/templates/query.sql.jinja +15 -11
  37. fabricks/context/__init__.py +18 -4
  38. fabricks/context/_types.py +2 -0
  39. fabricks/context/config/__init__.py +92 -0
  40. fabricks/context/config/utils.py +53 -0
  41. fabricks/context/log.py +8 -2
  42. fabricks/context/runtime.py +87 -263
  43. fabricks/context/secret.py +1 -1
  44. fabricks/context/spark_session.py +1 -1
  45. fabricks/context/utils.py +76 -0
  46. fabricks/core/dags/generator.py +6 -7
  47. fabricks/core/dags/log.py +2 -15
  48. fabricks/core/dags/processor.py +11 -11
  49. fabricks/core/dags/utils.py +15 -1
  50. fabricks/core/{scripts/job_schema.py → job_schema.py} +4 -0
  51. fabricks/core/jobs/base/_types.py +64 -22
  52. fabricks/core/jobs/base/checker.py +13 -12
  53. fabricks/core/jobs/base/configurator.py +41 -67
  54. fabricks/core/jobs/base/generator.py +55 -24
  55. fabricks/core/jobs/base/invoker.py +54 -30
  56. fabricks/core/jobs/base/processor.py +43 -26
  57. fabricks/core/jobs/bronze.py +45 -38
  58. fabricks/core/jobs/get_jobs.py +2 -2
  59. fabricks/core/jobs/get_schedule.py +10 -0
  60. fabricks/core/jobs/get_schedules.py +32 -0
  61. fabricks/core/jobs/gold.py +61 -48
  62. fabricks/core/jobs/silver.py +39 -40
  63. fabricks/core/masks.py +52 -0
  64. fabricks/core/parsers/base.py +2 -2
  65. fabricks/core/schedules/__init__.py +14 -0
  66. fabricks/core/schedules/diagrams.py +46 -0
  67. fabricks/core/schedules/get_schedule.py +5 -0
  68. fabricks/core/schedules/get_schedules.py +9 -0
  69. fabricks/core/schedules/run.py +3 -0
  70. fabricks/core/schedules/views.py +61 -0
  71. fabricks/core/steps/base.py +110 -72
  72. fabricks/core/udfs.py +12 -23
  73. fabricks/core/views.py +20 -13
  74. fabricks/deploy/__init__.py +97 -0
  75. fabricks/deploy/masks.py +8 -0
  76. fabricks/deploy/notebooks.py +71 -0
  77. fabricks/deploy/schedules.py +8 -0
  78. fabricks/{core/deploy → deploy}/tables.py +16 -13
  79. fabricks/{core/deploy → deploy}/udfs.py +3 -1
  80. fabricks/deploy/utils.py +36 -0
  81. fabricks/{core/deploy → deploy}/views.py +5 -9
  82. fabricks/metastore/database.py +3 -3
  83. fabricks/metastore/dbobject.py +4 -4
  84. fabricks/metastore/table.py +157 -88
  85. fabricks/metastore/view.py +13 -6
  86. fabricks/utils/_types.py +6 -0
  87. fabricks/utils/azure_table.py +4 -3
  88. fabricks/utils/helpers.py +141 -11
  89. fabricks/utils/log.py +29 -18
  90. fabricks/utils/read/_types.py +1 -1
  91. fabricks/utils/schema/get_schema_for_type.py +6 -0
  92. fabricks/utils/write/delta.py +3 -3
  93. {fabricks-3.0.5.2.dist-info → fabricks-3.0.6.dist-info}/METADATA +2 -1
  94. fabricks-3.0.6.dist-info/RECORD +175 -0
  95. fabricks/api/notebooks/add_fabricks.py +0 -13
  96. fabricks/api/notebooks/optimize.py +0 -29
  97. fabricks/api/notebooks/vacuum.py +0 -29
  98. fabricks/cdc/templates/query/context.sql.jinja +0 -101
  99. fabricks/cdc/templates/query/current.sql.jinja +0 -32
  100. fabricks/cdc/templates/query/deduplicate_hash.sql.jinja +0 -21
  101. fabricks/cdc/templates/query/deduplicate_key.sql.jinja +0 -14
  102. fabricks/cdc/templates/query/hash.sql.jinja +0 -1
  103. fabricks/cdc/templates/query/slice.sql.jinja +0 -14
  104. fabricks/config/__init__.py +0 -0
  105. fabricks/config/base.py +0 -8
  106. fabricks/config/fabricks/__init__.py +0 -26
  107. fabricks/config/fabricks/base.py +0 -90
  108. fabricks/config/fabricks/environment.py +0 -9
  109. fabricks/config/fabricks/pyproject.py +0 -47
  110. fabricks/config/jobs/__init__.py +0 -6
  111. fabricks/config/jobs/base.py +0 -101
  112. fabricks/config/jobs/bronze.py +0 -38
  113. fabricks/config/jobs/gold.py +0 -27
  114. fabricks/config/jobs/silver.py +0 -22
  115. fabricks/config/runtime.py +0 -67
  116. fabricks/config/steps/__init__.py +0 -6
  117. fabricks/config/steps/base.py +0 -50
  118. fabricks/config/steps/bronze.py +0 -7
  119. fabricks/config/steps/gold.py +0 -14
  120. fabricks/config/steps/silver.py +0 -15
  121. fabricks/core/deploy/__init__.py +0 -17
  122. fabricks/core/schedules.py +0 -142
  123. fabricks/core/scripts/__init__.py +0 -9
  124. fabricks/core/scripts/armageddon.py +0 -87
  125. fabricks/core/scripts/stats.py +0 -51
  126. fabricks/core/scripts/steps.py +0 -26
  127. fabricks-3.0.5.2.dist-info/RECORD +0 -177
  128. /fabricks/cdc/templates/{filter → filters}/final.sql.jinja +0 -0
  129. /fabricks/cdc/templates/{filter → filters}/latest.sql.jinja +0 -0
  130. /fabricks/cdc/templates/{filter → filters}/update.sql.jinja +0 -0
  131. /fabricks/cdc/templates/{merge → merges}/scd1.sql.jinja +0 -0
  132. /fabricks/cdc/templates/{merge → merges}/scd2.sql.jinja +0 -0
  133. /fabricks/cdc/templates/{query → queries}/__init__.py +0 -0
  134. /fabricks/cdc/templates/{query → queries}/final.sql.jinja +0 -0
  135. /fabricks/core/{utils.py → parsers/utils.py} +0 -0
  136. /fabricks/core/{scripts → schedules}/generate.py +0 -0
  137. /fabricks/core/{scripts → schedules}/process.py +0 -0
  138. /fabricks/core/{scripts → schedules}/terminate.py +0 -0
  139. {fabricks-3.0.5.2.dist-info → fabricks-3.0.6.dist-info}/WHEEL +0 -0
@@ -7,7 +7,7 @@ from fabricks.metastore.table import Table
7
7
 
8
8
 
9
9
  def deploy_tables(drop: bool = False):
10
- DEFAULT_LOGGER.info("🌟 (create or replace tables)")
10
+ DEFAULT_LOGGER.info("create or replace fabricks (default) tables")
11
11
 
12
12
  create_table_log(drop)
13
13
  create_table_dummy(drop)
@@ -64,16 +64,19 @@ def create_table_log(drop: bool = False):
64
64
 
65
65
 
66
66
  def create_table_dummy(drop: bool = False):
67
- table = NoCDC("fabricks", "dummy")
68
- df = SPARK.sql(
69
- """
70
- select
71
- 1 as __key,
72
- md5('1') as __hash,
73
- cast('1900-01-01' as timestamp) as __valid_from,
74
- cast('9999-12-31' as timestamp) as __valid_to
75
- """
76
- )
67
+ cdc = NoCDC("fabricks", "dummy")
68
+
77
69
  if drop:
78
- table.drop()
79
- table.overwrite(df)
70
+ cdc.drop()
71
+
72
+ if not cdc.table.exists():
73
+ df = SPARK.sql(
74
+ """
75
+ select
76
+ 1 as __key,
77
+ md5('1') as __hash,
78
+ cast('1900-01-01' as timestamp) as __valid_from,
79
+ cast('9999-12-31' as timestamp) as __valid_to
80
+ """
81
+ )
82
+ cdc.overwrite(df)
@@ -1,11 +1,13 @@
1
1
  from fabricks.context import SPARK
2
2
  from fabricks.context.log import DEFAULT_LOGGER
3
+ from fabricks.core.udfs import register_all_udfs
3
4
  from fabricks.utils.sqlglot import fix as fix_sql
4
5
 
5
6
 
6
7
  def deploy_udfs():
7
- DEFAULT_LOGGER.info("🌟 (create or replace udfs)")
8
+ DEFAULT_LOGGER.info("create or replace udfs")
8
9
 
10
+ register_all_udfs(extension="sql")
9
11
  create_or_replace_udf_job_id()
10
12
 
11
13
 
@@ -0,0 +1,36 @@
1
+ import time
2
+
3
+
4
+ def print_atomic_bomb(nowait: bool = False):
5
+ def print_and_wait(message: str):
6
+ if not nowait:
7
+ time.sleep(0.5)
8
+ print(message)
9
+
10
+ print("")
11
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⠤⠴⠾⠋⠉⠛⢾⡏⠙⠿⠦⠤⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
12
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⢶⣿⠉⢀⣀⡠⠆⠀⠀⠀⠀⠀⠀⠀⢤⣀⣀⠈⢹⣦⢤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
13
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠁⢋⡙⠁⠀⡝⠀⠀⠀⠀⣀⡸⠋⠁⠀⠀⠹⡀⠀⠈⠈⠆⢹⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
14
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣿⣁⡡⣴⡏⠀⠀⠀⢀⠀⢧⣀⠄⠀⠀⠀⣀⣰⠆⢀⠁⠀⠀⢈⣶⡤⣀⢹⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀ ")
15
+ print_and_wait(" ⠀⠀⠀⠀⠀⣠⢴⠟⢁⡝⠀⠁⠀⠃⠉⠀⠀⠘⣯⠀⡀⠾⣤⣄⣠⢤⠾⠄⠀⣸⠖⠀⠀⠈⠀⠃⠀⠀⠹⡄⠙⣶⢤⡀⠀⠀⠀⠀⠀ ")
16
+ print_and_wait(" ⠀⠀⠀⣠⠾⡇⠈⣀⡞⠀⠀⠀⠀⡀⠀⢀⣠⣄⣇⠀⣳⠴⠃⠀⠀⠀⠣⢴⠉⣰⣇⣀⣀⠀⠀⡄⠀⠀⠀⢹⣄⡘⠈⡷⣦⠀⠀⠀⠀ ")
17
+ print_and_wait(" ⢠⠞⠉⢻⡄⠀⠀⠈⠙⠀⠀⠀⠀⠙⣶⣏⣤⣤⠟⠉⠁⠀⠀⠀⠀⠀⠀⠀⠉⠙⢦⣱⣌⣷⠊⠀⠀⠀⠀⠈⠁⠀⠀⠀⡝⠉⠻⣄⠀ ")
18
+ print_and_wait(" ⠛⢀⡠⢼⡇⠀⠀⢀⡄⠀⢀⣀⡽⠚⠁⠀⠀⠀⢠⡀⢠⣀⠠⣔⢁⡀⠀⣄⠀⡄⠀⠀⠀⠈⠑⠺⣄⡀⠀⠠⡀⠀⠀⢠⡧⠄⠀⠘⢧ ")
19
+ print_and_wait(" ⡶⠋⠀⠀⠈⣠⣈⣩⠗⠒⠋⠀⠀⠀⠀⣀⣠⣆⡼⣷⣞⠛⠻⡉⠉⡟⠒⡛⣶⠧⣀⣀⣀⠀⠀⠀⠀⠈⠓⠺⢏⣉⣠⠋⠀⠀⠀⢢⣸ ")
20
+ print_and_wait(" ⠇⠐⠤⠤⠖⠁⣿⣀⣀⠀⠀⠀⠀⠀⠉⠁⠈⠉⠙⠛⢿⣷⡄⢣⡼⠀⣾⣿⠧⠒⠓⠚⠛⠉⠀⠀⠀⠀⠀⢀⣀⣾⡉⠓⠤⡤⠄⠸⢿ ")
21
+ print_and_wait(" ⣆⣤⠀⠀⠠⠀⠈⠓⠈⠓⠤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⢸⠀⢸⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠒⠁⠰⠃⠀⠠⠀⠀⢀⣀⠞ ")
22
+ print_and_wait(" ⠀⠉⠓⢲⣄⡈⢀⣠⠀⠀⠀⡸⠶⠂⠀⠀⢀⠀⠀⠤⠞⢻⡇⠀⠀⢘⡟⠑⠤⠄⠀⢀⠀⠀⠐⠲⢿⡀⠀⠀⢤⣀⢈⣀⡴⠖⠋⠀⠀ ")
23
+ print_and_wait(" ⠀⠀⠀⠀⠈⠉⠉⠙⠓⠒⣾⣁⣀⣴⠀⣀⠙⢧⠂⢀⣆⣀⣷⣤⣀⣾⣇⣀⡆⠀⢢⠛⢁⠀⢰⣀⣀⣹⠒⠒⠛⠉⠉⠉⠀⠀⠀⠀⠀ ")
24
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠈⠉⠉⠛⠉⠙⠉⠀⠀⣿⡟⣿⣿⠀⠀⠈⠉⠉⠙⠋⠉⠉⠀⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
25
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⢻⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
26
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⠁⠀⢹⡛⣟⡶⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
27
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠛⢯⣽⡟⢿⣿⠛⠿⠳⠞⠻⣿⠻⣆⢽⠟⣶⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
28
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠛⠃⠲⠯⠴⣦⣼⣷⣤⣤⣶⣤⣩⡧⠽⠷⠐⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
29
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⡇⠀⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
30
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣄⡀⢀⣀⣠⡾⡿⢡⢐⠻⣿⣄⣀⡀⠀⣀⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
31
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⢴⡏⠁⠀⠝⠉⣡⠟⣰⠃⢸⣿⠀⣷⠙⢧⡉⠻⡅⠀⠙⡷⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
32
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡟⠀⠈⣿⢄⡴⠞⠻⣄⣰⣡⠤⣞⣸⡤⢬⣧⣀⡿⠛⠦⣤⣶⡃⠀⢹⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ")
33
+ print_and_wait(" ⠀⠀⠀⠀⠀⠀⢀⣴⣶⡿⠃⠉⢺⠁⠙⠒⠀⠀⣠⡉⠀⠉⠚⠉⠉⠑⠈⠀⠈⣧⠀⠀⠒⠋⠀⡹⠋⠀⢻⡶⠶⡄⠀⠀⠀⠀⠀⠀⠀ ")
34
+ print_and_wait(" ⠀⠀⠀⠀⠀⣠⣾⣿⣇⠁⢈⡦⠀⡍⠋⠁⡀⠸⡋⠀⠀⠀⢘⠏⠉⡏⠀⠀⠀⢉⡷⠀⡌⠉⠋⡇⠠⣏⠈⢁⣦⣿⣦⠀⠀⠀⠀⠀⠀ ")
35
+ print_and_wait(" ⠀⠀⠀⠀⠀⠉⣁⠀⠉⠉⠉⠙⠛⠛⠒⠚⠳⠤⢼⣤⣠⠤⣮⣠⣤⣼⠦⢤⣤⣿⠤⠾⠓⠒⠛⢓⠛⠉⠉⠉⠀⠈⠉⠀⠀⠀⠀⠀⠀ ")
36
+ print("")
@@ -5,24 +5,20 @@ from fabricks.utils.sqlglot import fix as fix_sql
5
5
 
6
6
 
7
7
  def deploy_views():
8
- DEFAULT_LOGGER.info("🌟 (create or replace views)")
8
+ DEFAULT_LOGGER.info("create or replace fabricks (default) views")
9
9
 
10
10
  create_or_replace_jobs_view()
11
11
  create_or_replace_tables_view()
12
12
  create_or_replace_views_view()
13
-
14
13
  create_or_replace_logs_pivot_view()
15
14
  create_or_replace_last_schedule_view()
16
15
  create_or_replace_last_status_view()
17
16
  create_or_replace_previous_schedule_view()
18
-
19
17
  create_or_replace_schedules_view()
20
-
21
18
  create_or_replace_dependencies_view()
22
19
  create_or_replace_dependencies_flat_view()
23
20
  create_or_replace_dependencies_unpivot_view()
24
21
  create_or_replace_dependencies_circular_view()
25
-
26
22
  create_or_replace_jobs_to_be_updated_view()
27
23
 
28
24
 
@@ -73,7 +69,7 @@ def create_or_replace_jobs_view():
73
69
  dmls.append(dml)
74
70
 
75
71
  except Exception:
76
- DEFAULT_LOGGER.warning(f"fabricks.{table} not found")
72
+ DEFAULT_LOGGER.debug(f"could not find fabricks.{table}")
77
73
 
78
74
  sql = f"""create or replace view fabricks.jobs with schema evolution as {" union all ".join(dmls)}"""
79
75
  sql = fix_sql(sql)
@@ -100,7 +96,7 @@ def create_or_replace_tables_view():
100
96
  dmls.append(dml)
101
97
 
102
98
  except Exception:
103
- DEFAULT_LOGGER.warning(f"fabricks.{step}_tables not found")
99
+ DEFAULT_LOGGER.debug(f"could not find fabricks.{step}_tables")
104
100
 
105
101
  sql = f"""create or replace view fabricks.tables with schema evolution as {" union all ".join(dmls)}"""
106
102
  sql = fix_sql(sql)
@@ -127,7 +123,7 @@ def create_or_replace_views_view():
127
123
  dmls.append(dml)
128
124
 
129
125
  except Exception:
130
- DEFAULT_LOGGER.warning(f"fabricks.{step}_views not found")
126
+ DEFAULT_LOGGER.debug(f"could not find fabricks.{step}_views")
131
127
 
132
128
  sql = f"""create or replace view fabricks.views with schema evolution as {" union all ".join(dmls)}"""
133
129
  sql = fix_sql(sql)
@@ -157,7 +153,7 @@ def create_or_replace_dependencies_view():
157
153
  dmls.append(dml)
158
154
 
159
155
  except Exception:
160
- DEFAULT_LOGGER.warning(f"fabricks.{step}_dependencies not found")
156
+ DEFAULT_LOGGER.debug(f"could not find fabricks.{step}_dependencies")
161
157
 
162
158
  sql = f"""create or replace view fabricks.dependencies with schema evolution as {" union all ".join(dmls)}"""
163
159
  sql = fix_sql(sql)
@@ -33,17 +33,17 @@ class Database:
33
33
  return self.storage.joinpath("delta")
34
34
 
35
35
  def create(self):
36
- DEFAULT_LOGGER.info("🌟 (create database)", extra={"step": self})
36
+ DEFAULT_LOGGER.info("create database", extra={"label": self})
37
37
  self.spark.sql(f"create database if not exists {self.name};")
38
38
 
39
39
  def drop(self, rm: Optional[bool] = True):
40
40
  if self.exists():
41
- DEFAULT_LOGGER.warning("💣 (drop database)", extra={"step": self})
41
+ DEFAULT_LOGGER.warning("drop database", extra={"label": self})
42
42
  self.spark.sql(f"drop database if exists {self.name} cascade;")
43
43
 
44
44
  if rm:
45
45
  if self.delta_path.exists():
46
- DEFAULT_LOGGER.debug("🧹 (remove delta files)", extra={"step": self})
46
+ DEFAULT_LOGGER.debug("remove delta files", extra={"label": self})
47
47
  self.delta_path.rm()
48
48
 
49
49
  def exists(self) -> bool:
@@ -29,7 +29,7 @@ class DbObject:
29
29
  return f"{self.database.name}.{self.name}"
30
30
 
31
31
  @property
32
- def is_registered(self) -> bool:
32
+ def registered(self) -> bool:
33
33
  try:
34
34
  df = self.spark.sql(f"show tables in {self.database}").where(f"tableName == '{self.name}'")
35
35
  return not df.isEmpty()
@@ -51,15 +51,15 @@ class DbObject:
51
51
  if self.is_view:
52
52
  return False
53
53
  else:
54
- return self.is_registered
54
+ return self.registered
55
55
 
56
56
  def drop(self):
57
57
  if self.is_view:
58
- DEFAULT_LOGGER.warning("drop view from metastore", extra={"job": self})
58
+ DEFAULT_LOGGER.warning("drop view from metastore", extra={"label": self})
59
59
  self.spark.sql(f"drop view if exists {self}")
60
60
 
61
61
  elif self.is_table:
62
- DEFAULT_LOGGER.warning("drop table from metastore", extra={"job": self})
62
+ DEFAULT_LOGGER.warning("drop table from metastore", extra={"label": self})
63
63
  self.spark.sql(f"drop table if exists {self}")
64
64
 
65
65
  def __str__(self):