@@ -106,7 +106,14 @@ export abstract class BaseSchemaFormatter {
106106 const table = `${
107107 tableSchema . schema ?. length ? `${ this . escapeName ( tableSchema . schema ) } .` : ''
108108 } ${ this . escapeName ( tableSchema . table ) } `;
109-
109+
110+ const { dataSource, ...contextProps } = schemaContext ;
111+
112+ let dataSourceProp = { } ;
113+ if ( dataSource ) {
114+ dataSourceProp = this . options . snakeCase ? { data_source : dataSource } : { dataSource } ;
115+ }
116+
110117 const sqlOption = this . options . snakeCase
111118 ? {
112119 sql_table : table ,
@@ -118,10 +125,12 @@ export abstract class BaseSchemaFormatter {
118125 return {
119126 cube : tableSchema . cube ,
120127 ...sqlOption ,
128+ ...dataSourceProp ,
129+
121130 [ this . options . snakeCase ? 'pre_aggregations' : 'preAggregations' ] : new ValueWithComments (
122131 null ,
123132 [
124- 'Pre-Aggregations definitions go here' ,
133+ 'Pre-aggregation definitions go here' ,
125134 'Learn more here: https://cube.dev/docs/caching/pre-aggregations/getting-started' ,
126135 ]
127136 ) ,
@@ -164,9 +173,9 @@ export abstract class BaseSchemaFormatter {
164173 . reduce ( ( a , b ) => ( { ...a , ...b } ) , { } ) ,
165174 ...( this . options . snakeCase
166175 ? Object . fromEntries (
167- Object . entries ( schemaContext ) . map ( ( [ key , value ] ) => [ toSnakeCase ( key ) , value ] )
176+ Object . entries ( contextProps ) . map ( ( [ key , value ] ) => [ toSnakeCase ( key ) , value ] )
168177 )
169- : schemaContext ) ,
178+ : contextProps ) ,
170179 } ;
171180 }
172181
@@ -196,10 +205,6 @@ export abstract class BaseSchemaFormatter {
196205 }
197206 ) ;
198207
199- const dimensionNames = cubeMembers . dimensions
200- . filter ( ( d ) => d . included || d . included == null )
201- . map ( ( d ) => d . name ) ;
202-
203208 return {
204209 ...generatedDescriptor ,
205210 ...descriptor ,
0 commit comments