dbt-cube-sync 0.1.0a1__py3-none-any.whl → 0.1.0a2__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.
- dbt_cube_sync/connectors/superset.py +30 -15
- {dbt_cube_sync-0.1.0a1.dist-info → dbt_cube_sync-0.1.0a2.dist-info}/METADATA +1 -1
- {dbt_cube_sync-0.1.0a1.dist-info → dbt_cube_sync-0.1.0a2.dist-info}/RECORD +5 -5
- {dbt_cube_sync-0.1.0a1.dist-info → dbt_cube_sync-0.1.0a2.dist-info}/WHEEL +0 -0
- {dbt_cube_sync-0.1.0a1.dist-info → dbt_cube_sync-0.1.0a2.dist-info}/entry_points.txt +0 -0
|
@@ -191,15 +191,15 @@ class SupersetConnector(BaseConnector):
|
|
|
191
191
|
|
|
192
192
|
cube_name = cube_name_match.group(1)
|
|
193
193
|
|
|
194
|
-
#
|
|
194
|
+
# Use public schema and cube name for Superset dataset
|
|
195
|
+
schema_name = "public"
|
|
196
|
+
table_name = cube_name # Use cube name (not database table name)
|
|
197
|
+
|
|
198
|
+
# Extract actual database table for reference (but don't use it for dataset)
|
|
195
199
|
sql_match = re.search(r'sql:\s*[`"\']\s*SELECT\s+.*FROM\s+(\w+\.\w+)', content, re.IGNORECASE)
|
|
200
|
+
actual_db_table = None
|
|
196
201
|
if sql_match:
|
|
197
|
-
|
|
198
|
-
schema_name, table_name = schema_table.split('.')
|
|
199
|
-
else:
|
|
200
|
-
# Fallback to cube name
|
|
201
|
-
schema_name = "public"
|
|
202
|
-
table_name = cube_name
|
|
202
|
+
actual_db_table = sql_match.group(1)
|
|
203
203
|
|
|
204
204
|
print(f" Cube: {cube_name}")
|
|
205
205
|
print(f" Schema: {schema_name}")
|
|
@@ -214,7 +214,8 @@ class SupersetConnector(BaseConnector):
|
|
|
214
214
|
return {
|
|
215
215
|
'cube_name': cube_name,
|
|
216
216
|
'schema': schema_name,
|
|
217
|
-
'table_name': table_name,
|
|
217
|
+
'table_name': table_name, # This is now the cube name for dataset creation
|
|
218
|
+
'actual_db_table': actual_db_table, # This is the real DB table
|
|
218
219
|
'dimensions': dimensions,
|
|
219
220
|
'measures': measures
|
|
220
221
|
}
|
|
@@ -408,13 +409,27 @@ class SupersetConnector(BaseConnector):
|
|
|
408
409
|
"""Create a new dataset in Superset"""
|
|
409
410
|
dataset_url = f"{self.base_url}/api/v1/dataset/"
|
|
410
411
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
"
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
412
|
+
# If we have actual DB table info, use custom SQL, otherwise use table reference
|
|
413
|
+
if schema_info.get('actual_db_table'):
|
|
414
|
+
# Create a custom SQL dataset that references the actual table but is named with cube name
|
|
415
|
+
sql_query = f"SELECT * FROM {schema_info['actual_db_table']}"
|
|
416
|
+
payload = {
|
|
417
|
+
"database": self.database_id,
|
|
418
|
+
"schema": schema_info['schema'], # "public"
|
|
419
|
+
"table_name": schema_info['table_name'], # cube name like "CoursePerformanceSummary"
|
|
420
|
+
"sql": sql_query,
|
|
421
|
+
"normalize_columns": False,
|
|
422
|
+
"always_filter_main_dttm": False
|
|
423
|
+
}
|
|
424
|
+
else:
|
|
425
|
+
# Fallback to direct table reference
|
|
426
|
+
payload = {
|
|
427
|
+
"database": self.database_id,
|
|
428
|
+
"schema": schema_info['schema'],
|
|
429
|
+
"table_name": schema_info['table_name'],
|
|
430
|
+
"normalize_columns": False,
|
|
431
|
+
"always_filter_main_dttm": False
|
|
432
|
+
}
|
|
418
433
|
|
|
419
434
|
print(f"\\n📊 Creating new dataset: {schema_info['table_name']}")
|
|
420
435
|
response = self.session.post(dataset_url, json=payload)
|
|
@@ -4,13 +4,13 @@ dbt_cube_sync/config.py,sha256=qhGE7CxTmh0RhPizgd3x3Yj-3L2LoC00UQIDT0q9FlQ,3858
|
|
|
4
4
|
dbt_cube_sync/connectors/__init__.py,sha256=NG6tYZ3CYD5bG_MfNLZrUM8YoBEKArG8-AOmJ8pwvQI,52
|
|
5
5
|
dbt_cube_sync/connectors/base.py,sha256=JLzerxJdt34z0kWuyieL6UQhf5_dUYPGmwkiRWBuSPY,2802
|
|
6
6
|
dbt_cube_sync/connectors/powerbi.py,sha256=2Y8fTfh_6Q_Myma1ymipPh1U3HsfQKcktVequXXnIXI,1275
|
|
7
|
-
dbt_cube_sync/connectors/superset.py,sha256=
|
|
7
|
+
dbt_cube_sync/connectors/superset.py,sha256=vVbCVaotErF-fonc9_-kfrLsmbJaZdc2_dAF9YdaDD4,21811
|
|
8
8
|
dbt_cube_sync/connectors/tableau.py,sha256=jKve1zErzTbgPOtmPB92ZwZl4I6uEySedM51JiwlGrE,1261
|
|
9
9
|
dbt_cube_sync/core/__init__.py,sha256=kgsawtU5dqEvnHz6dU8qwJbH3rtIV7QlK2MhtYVDCaY,46
|
|
10
10
|
dbt_cube_sync/core/cube_generator.py,sha256=JtFEqlr9_ShS0e9LxjE0I1HlU13x7MX5sQ3O1G4r9ns,6444
|
|
11
11
|
dbt_cube_sync/core/dbt_parser.py,sha256=Woed3RCuluVFaRZgjG1m0m-v2c4_Zb721lQq5hLKXqM,6521
|
|
12
12
|
dbt_cube_sync/core/models.py,sha256=PvfE4A_1K_fSutO_KdzseBuRp-ZQtyKCW3Qonzu0NuU,1543
|
|
13
|
-
dbt_cube_sync-0.1.
|
|
14
|
-
dbt_cube_sync-0.1.
|
|
15
|
-
dbt_cube_sync-0.1.
|
|
16
|
-
dbt_cube_sync-0.1.
|
|
13
|
+
dbt_cube_sync-0.1.0a2.dist-info/METADATA,sha256=7K1IQovvpiaCSFZXQN0Ep48_qjT2otAd_dQJ-1jvfac,6116
|
|
14
|
+
dbt_cube_sync-0.1.0a2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
15
|
+
dbt_cube_sync-0.1.0a2.dist-info/entry_points.txt,sha256=iEAB_nZ1AoSeFwSHPY2tr02xmTHLVFKp5CJeFh0AfCw,56
|
|
16
|
+
dbt_cube_sync-0.1.0a2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|