Azure / Azure/data-api-builder

[Enhancement]: Expose Command Timeout

Aperta
#2,766 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement mssql pgsql mysql pgsql
Lingua principale
C#
Stelle
1.5k
Fork
370
Merge medio
3g 22h
PR unite (30g)
9

Descrizione

## What?

Introduce a command timeout.

## Why?

Today, the only `timeout` value supported is in the connection string. This is the threshold for connecting to the database. This is NOT a timeout for query execution.

In our current [`PrepareDbCommand`](https://github.com/Azure/data-api-builder/blob/48d1f8f5f2837a7efb09b71725a30aa229af56be/src/Core/Resolvers/QueryExecutor.cs#L343-L357) method, we do not set an explicit timeout. Instead, we accept the default timeout ([which is 30 seconds](https://github.com/microsoft/referencesource/blob/f7df9e2399ecd273e90908ac11caf1433e142448/System.Data/System/Data/Common/AdapterUtil.cs#L1845)) which is fine for many queries but not for every query.

## Config file change

Add optional `command-timeout-seconds` under `data-source`.

```json
{
"data-source": {
"command-timeout-seconds":
}
}
```

1. Copy the defaults of [`CommandTimeout`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.data.sqlclient.sqlcommand.commandtimeout?view=sqlclient-dotnet-core-6.0).
1. Copy the supported range of [`CommandTimeout`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.data.sqlclient.sqlcommand.commandtimeout?view=sqlclient-dotnet-core-6.0).
1. Ensure this works for MSSQL, SQLDW, PG, MYSQL, and Cosmos.

### Additional

1. Add JSON Schema property
1. Add JSON Schema constraints
1. Add to `dab configure --data-source.command-timeout-seconds`
1. Add to `dab validate` (not required because of JSON schema)
1. Add to DAB documentation

#### Sample JSON schema

```json
"command-timeout-seconds": {
"type": "integer",
"title": "Command Timeout Seconds",
"description": "The wait time (in seconds) before terminating a command execution attempt and generating an error. Applies to query execution, not connection.",
"minimum": 0,
"maximum": 2147483647,
"default": 30
}
```

## Related

- #2750

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in src/Core/Resolvers/QueryExecutor.cs, in PrepareDbCommand, quindi segui il percorso della configurazione dell'origine dati fino all'esecuzione del comando. Controlla lo schema JSON e il comando dab configure data-source, quindi esamina i percorsi MSSQL, SQLDW, PG, MYSQL e Cosmos. Il lavoro è completato quando l'impostazione facoltativa è supportata da tutti questi provider, vincolata nello schema e nella CLI e documentata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
cli, databases, documentation
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.