or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

cli-interface.mdconfiguration.mddata-models.mddatabase-connectors.mdindex.mdsecurity.mdsql-lab.mdutilities.mdvisualization.mdweb-application.md

web-application.mddocs/

0

# Web Application

1

2

Flask-based web application with comprehensive REST API endpoints for dashboard management, data exploration, and administrative functions. The application provides both synchronous and asynchronous view handlers for optimal performance and user experience.

3

4

## Capabilities

5

6

### Core Application Views

7

8

Main application functionality for data exploration, dashboard management, and system administration.

9

10

```python { .api }

11

class Superset:

12

def datasources(self):

13

"""

14

List available datasources.

15

Returns JSON list of accessible datasources for current user.

16

"""

17

18

def override_role_permissions(self):

19

"""

20

Override user role permissions.

21

Administrative function for temporary permission elevation.

22

"""

23

24

def request_access(self):

25

"""

26

Request datasource access.

27

Submit access request for restricted datasources.

28

"""

29

30

def approve(self):

31

"""

32

Approve access requests.

33

Administrative function for granting datasource access.

34

"""

35

36

def slice(self, slice_id):

37

"""

38

View slice/chart details.

39

40

Parameters:

41

- slice_id: int, chart identifier

42

43

Returns:

44

Slice detail view with metadata and configuration

45

"""

46

47

def slice_json(self, slice_id):

48

"""

49

Get slice JSON data.

50

51

Parameters:

52

- slice_id: int, chart identifier

53

54

Returns:

55

JSON representation of chart data and configuration

56

"""

57

58

def annotation_json(self, layer_id):

59

"""

60

Get annotation layer data.

61

62

Parameters:

63

- layer_id: int, annotation layer identifier

64

65

Returns:

66

JSON data for annotation layer

67

"""

68

```

69

70

### Data Exploration API

71

72

RESTful endpoints for interactive data exploration and visualization.

73

74

```python { .api }

75

class Superset:

76

def explore_json(self, datasource_type=None, datasource_id=None):

77

"""

78

Explore data API endpoint.

79

Core endpoint for chart data generation and exploration.

80

81

Parameters:

82

- datasource_type: str, type of datasource ('table' or 'druid')

83

- datasource_id: int, datasource identifier

84

85

HTTP Methods: GET, POST

86

87

Returns:

88

JSON response with chart data, query metadata, and caching info

89

"""

90

91

def explorev2(self, datasource_type, datasource_id):

92

"""

93

Explore v2 interface.

94

Enhanced exploration interface with improved performance.

95

96

Parameters:

97

- datasource_type: str, datasource type

98

- datasource_id: int, datasource identifier

99

100

Returns:

101

Enhanced exploration interface

102

"""

103

104

def explore(self, datasource_type=None, datasource_id=None):

105

"""

106

Main explore interface.

107

Interactive chart builder and data exploration interface.

108

109

Parameters:

110

- datasource_type: str, optional datasource type

111

- datasource_id: int, optional datasource identifier

112

113

HTTP Methods: GET, POST

114

115

Returns:

116

Chart builder interface

117

"""

118

119

def filter(self, datasource_type, datasource_id, column):

120

"""

121

Get column filter values.

122

Retrieve distinct values for filter dropdowns.

123

124

Parameters:

125

- datasource_type: str, datasource type

126

- datasource_id: int, datasource identifier

127

- column: str, column name for filtering

128

129

Returns:

130

JSON list of distinct column values

131

"""

132

```

133

134

### Dashboard Management

135

136

Endpoints for dashboard creation, modification, and sharing.

137

138

```python { .api }

139

class Superset:

140

def import_dashboards(self):

141

"""

142

Import dashboard functionality.

143

Upload and import dashboard JSON definitions.

144

145

HTTP Methods: GET, POST

146

147

Returns:

148

Import interface and processing results

149

"""

150

151

def copy_dash(self, dashboard_id):

152

"""

153

Copy dashboard.

154

Create duplicate of existing dashboard.

155

156

Parameters:

157

- dashboard_id: int, source dashboard identifier

158

159

HTTP Methods: GET, POST

160

161

Returns:

162

Dashboard copy interface and new dashboard

163

"""

164

165

def save_dash(self, dashboard_id):

166

"""

167

Save dashboard.

168

Update dashboard configuration and layout.

169

170

Parameters:

171

- dashboard_id: int, dashboard identifier

172

173

HTTP Methods: GET, POST

174

175

Returns:

176

Dashboard save confirmation

177

"""

178

179

def add_slices(self, dashboard_id):

180

"""

181

Add slices to dashboard.

182

Include charts in dashboard layout.

183

184

Parameters:

185

- dashboard_id: int, target dashboard identifier

186

187

HTTP Method: POST

188

189

Returns:

190

Updated dashboard with new slices

191

"""

192

```

193

194

### Database and Schema Operations

195

196

API endpoints for database connection management and metadata exploration.

197

198

```python { .api }

199

class Superset:

200

def testconn(self):

201

"""

202

Test database connection.

203

Validate database connection parameters.

204

205

HTTP Methods: POST, GET

206

207

Returns:

208

Connection test results and error details

209

"""

210

211

def schemas(self, db_id, force_refresh=None):

212

"""

213

Get database schemas.

214

215

Parameters:

216

- db_id: int, database identifier

217

- force_refresh: bool, optional cache bypass

218

219

Returns:

220

JSON list of available schemas

221

"""

222

223

def tables(self, db_id, schema, substr):

224

"""

225

Get schema tables with filter.

226

227

Parameters:

228

- db_id: int, database identifier

229

- schema: str, schema name

230

- substr: str, table name filter

231

232

Returns:

233

JSON list of matching table names

234

"""

235

236

def checkbox(self, model_view, id_, attr, value):

237

"""

238

Toggle checkbox values.

239

Update boolean attributes via AJAX.

240

241

Parameters:

242

- model_view: str, model view name

243

- id_: int, object identifier

244

- attr: str, attribute name

245

- value: str, new value

246

247

Returns:

248

Updated attribute value

249

"""

250

251

def recent_activity(self, user_id):

252

"""

253

Get user recent activity.

254

255

Parameters:

256

- user_id: int, user identifier

257

258

Returns:

259

JSON list of recent user activities

260

"""

261

```

262

263

### Key-Value Store

264

265

Simple key-value storage API for temporary data and user preferences.

266

267

```python { .api }

268

class KV:

269

def store(self):

270

"""

271

Store key-value data.

272

273

HTTP Method: POST

274

275

Returns:

276

Storage confirmation with key identifier

277

"""

278

279

def get(self, key_id):

280

"""

281

Retrieve stored data.

282

283

Parameters:

284

- key_id: str, storage key identifier

285

286

Returns:

287

Stored value or 404 if not found

288

"""

289

```

290

291

### URL Shortener

292

293

URL shortening service for sharing long dashboard and chart URLs.

294

295

```python { .api }

296

class R:

297

def redirect(self, url_id):

298

"""

299

Redirect to shortened URL.

300

301

Parameters:

302

- url_id: str, short URL identifier

303

304

Returns:

305

HTTP redirect to original URL

306

"""

307

308

def shortner(self):

309

"""

310

Create short URL.

311

Generate shortened URL for long dashboard/chart links.

312

313

HTTP Methods: POST, GET

314

315

Returns:

316

Short URL identifier and redirect link

317

"""

318

319

def msg(self):

320

"""

321

Display messages.

322

Show user messages and notifications.

323

324

Returns:

325

Message display interface

326

"""

327

```

328

329

### Model Views

330

331

CRUD interfaces for managing Superset objects through the web interface.

332

333

```python { .api }

334

class DatabaseView:

335

"""

336

Database connection management interface.

337

Provides CRUD operations for database connections,

338

YAML export functionality, and connection testing.

339

"""

340

341

class SliceModelView:

342

"""

343

Chart/slice management interface.

344

CRUD operations for charts with data exploration integration.

345

"""

346

347

class DashboardModelView:

348

"""

349

Dashboard management interface.

350

CRUD operations for dashboards with composition tools

351

and sharing/permissions management.

352

"""

353

354

class CssTemplateModelView:

355

"""

356

CSS template management interface.

357

CRUD operations for custom styling templates.

358

"""

359

360

class LogModelView:

361

"""

362

Audit log interface.

363

Read-only access to system activity logs

364

with filtering and search capabilities.

365

"""

366

```

367

368

### Asynchronous Views

369

370

Background processing interfaces for long-running operations.

371

372

```python { .api }

373

class DatabaseAsync:

374

"""

375

Asynchronous database operations.

376

Background connection testing and metadata loading.

377

"""

378

379

class SliceAsync:

380

"""

381

Asynchronous slice operations.

382

Background chart data loading and processing.

383

"""

384

385

class DashboardModelViewAsync:

386

"""

387

Asynchronous dashboard operations.

388

Background dashboard data aggregation and loading.

389

"""

390

391

class DatabaseTablesAsync:

392

"""

393

Asynchronous table listing.

394

Background schema exploration and metadata discovery.

395

"""

396

```

397

398

## Application Core

399

400

### Flask Application Setup

401

402

```python { .api }

403

app: Flask

404

"""

405

Main Flask application instance.

406

Configured with all Superset blueprints, extensions, and middleware.

407

"""

408

409

db: SQLAlchemy

410

"""

411

SQLAlchemy database instance (SQLA).

412

Main database connection for application metadata.

413

"""

414

415

appbuilder: AppBuilder

416

"""

417

Flask-AppBuilder instance.

418

Provides authentication, authorization, and admin interface.

419

"""

420

421

security_manager: SupersetSecurityManager

422

"""

423

Superset security manager instance.

424

Handles user authentication and permission management.

425

"""

426

427

cache: Cache

428

"""

429

Application cache instance.

430

Configurable backend for query results and metadata caching.

431

"""

432

433

tables_cache: Cache

434

"""

435

Tables metadata cache instance.

436

Specialized cache for database schema information.

437

"""

438

439

migrate: Migrate

440

"""

441

Flask-Migrate instance.

442

Database schema migration management.

443

"""

444

```

445

446

### Frontend Asset Management

447

448

```python { .api }

449

def parse_manifest_json():

450

"""

451

Parse frontend asset manifest.

452

Load webpack-generated asset mappings for production builds.

453

"""

454

455

def get_js_manifest_files(filename):

456

"""

457

Get JavaScript files for entry.

458

459

Parameters:

460

- filename: str, entry point name

461

462

Returns:

463

List of JavaScript file paths for entry

464

"""

465

466

def get_css_manifest_files(filename):

467

"""

468

Get CSS files for entry.

469

470

Parameters:

471

- filename: str, entry point name

472

473

Returns:

474

List of CSS file paths for entry

475

"""

476

477

def get_unloaded_chunks(files, loaded_chunks):

478

"""

479

Filter unloaded chunks.

480

481

Parameters:

482

- files: list, all available files

483

- loaded_chunks: set, already loaded chunk names

484

485

Returns:

486

List of unloaded chunk files

487

"""

488

```

489

490

## Integration

491

492

The web application integrates with:

493

494

- **React Frontend**: Single-page application for user interface

495

- **Flask-AppBuilder**: Authentication and admin interface framework

496

- **SQLAlchemy**: Database ORM and query generation

497

- **Celery**: Asynchronous task processing

498

- **Redis/Memcached**: Caching layer for performance

499

- **WebSocket**: Real-time updates and notifications