Data Source Queries
getAggregateDataSourceList
Future<AggregateDataSourceListResponse> app.models.getAggregateDataSourceList({
required int pageSize,
String? envId,
int? pageIndex,
int? queryAll,
List<String>? dataSourceIds,
List<String>? dataSourceNames,
String? dataSourceType,
List<String>? viewIds,
List<String>? appIds,
int? appLinkStatus,
int? queryBindToApp,
int? queryConnector,
List<String>? channelList,
bool? queryDataSourceRelationList,
String? dbInstanceType,
List<String>? databaseTableNames,
bool? querySystemModel,
})
Query the aggregate data source list by condition. envId is optional and defaults to the environment ID from initialization.
Parameters
Page size
Environment ID (optional, defaults to env from initialization)
Page index
Whether to query all (0 or 1)
Data source ID list
Data source name list
Data source type
View ID list
App ID list
App link status
Whether to query data sources bound to an app (0 or 1)
Whether to query connectors (0 or 1)
Channel list
Whether to query the data source relation list
Database instance type
Database table name list
Whether to query system models
Response
Example
- Example
final result = await app.models.getAggregateDataSourceList(
pageSize: 10,
pageIndex: 0,
);
if (result.isSuccess) {
print('Total: ${result.count}');
for (final ds in result.rows) {
print('${ds.name}: ${ds.title} (type: ${ds.type})');
}
}
getDataSourceAggregateDetail
Future<DataSourceAggregateDetailResponse> app.models.getDataSourceAggregateDetail({
String? datasourceId,
String? dataSourceName,
String? viewId,
int? queryPublish,
bool? queryModelRelation,
String? dbInstanceType,
String? databaseTableName,
})
Query aggregate data source detail by conditions. datasourceId and dataSourceName cannot both be empty.
Parameters
Data source ID (cannot both be empty with dataSourceName)
Data source name (cannot both be empty with datasourceId)
View ID
Query published data source (0: preview, 1: published)
Whether to query relation
DB instance type
Database table name
Response
Example
- Example
final result = await app.models.getDataSourceAggregateDetail(
dataSourceName: 'user',
);
if (result.isSuccess) {
print('Schema: ${result.dataSource?.schema}');
print('Name: ${result.dataSource?.title}');
}
getDataSourceByTableName
Future<DataSourceByTableNameResponse> app.models.getDataSourceByTableName({required List<String> tableNames})
Query data source schema definition by database table name.
Parameters
Database table name list
Response
Example
- Example
final result = await app.models.getDataSourceByTableName(
tableNames: ['user_table', 'order_table'],
);
if (result.isSuccess) {
for (final info in result.dataSourceTableInfos) {
print('Table: ${info.tableName}, Data source: ${info.name}');
}
}
getBasicDataSourceList
Future<BasicDataSourceListResponse> app.models.getBasicDataSourceList({
List<String>? idList,
List<String>? nameList,
int? pageNum,
int? pageSize,
bool? queryAll,
List<DataSourceQueryFilter>? queryFilterList,
bool? onlyFlexDb,
})
Query basic data source list by conditions (POST request, supports filter conditions).
Parameters
Data source ID list
Data source name list
Page number, default 1
Page size, default 10
Whether to query all
Query filter list
Whether to query only flexdb type
Response
Example
- Example
final result = await app.models.getBasicDataSourceList(
pageSize: 10,
pageNum: 1,
queryFilterList: [
DataSourceQueryFilter(name: 'Type', values: ['database']),
],
);
if (result.isSuccess) {
print('Total: ${result.total}');
for (final ds in result.dataSourceList) {
print('${ds.name}: ${ds.title}');
}
}
getBasicDataSource
Future<BasicDataSourceResponse> app.models.getBasicDataSource({
String? datasourceId,
String? dataSourceName,
String? viewId,
int? queryPublish,
bool? queryModelRelation,
String? dbInstanceType,
String? databaseTableName,
})
Query basic data source info by conditions. datasourceId and dataSourceName cannot both be empty.
Parameters
Data source ID (cannot both be empty with dataSourceName)
Data source name (cannot both be empty with datasourceId)
View ID
Query published data source (0: preview, 1: published)
Whether to query relation
DB instance type
Database table name
Response
Example
- Example
final result = await app.models.getBasicDataSource(
dataSourceName: 'user',
);
if (result.isSuccess) {
print('Data source: ${result.dataSource?.name}');
print('Type: ${result.dataSource?.type}');
}
getSchemaList
Future<DataSourceSchemaListResponse> app.models.getSchemaList({List<String>? dataSourceNameList})
Query all data source schemas in the environment. If no parameters are provided, all schemas are returned.
Parameters
Data source name list (optional, query all if not provided)
Response
Example
- Example
final result = await app.models.getSchemaList(
dataSourceNameList: ['user', 'order'],
);
if (result.isSuccess) {
for (final rel in result.dataSourceRelationInfoList) {
print('${rel.name}: ${rel.title}');
}
}
getTableName
Future<DataSourceTableNameResponse> app.models.getTableName({String? dataSourceName})
Query the corresponding database table name by data source name.
Parameters
Data source name
Response
Example
- Example
final result = await app.models.getTableName(
dataSourceName: 'user',
);
if (result.isSuccess) {
print('Table name: ${result.tableName}');
print('Database type: ${result.dbType}');
}