or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

current-data-streams.mdentry-points.mdhistorical-data-streams.mdindex.mdmain-source.mdstate-historical-streams.md

entry-points.mddocs/

0

# Entry Point Functions

1

2

Console script entry point and programmatic execution functions for running the RKI COVID-19 source connector. These functions provide the interface between the Airbyte platform and the connector implementation.

3

4

## Capabilities

5

6

### Console Script Entry Point

7

8

Main entry point function registered as a console script for command-line execution.

9

10

```python { .api }

11

def run():

12

"""

13

Main entry point for the source-rki-covid connector.

14

15

Creates a SourceRkiCovid instance and launches it using the Airbyte CDK

16

launch function with command-line arguments.

17

18

Usage:

19

- Called automatically when running: source-rki-covid [command] [args]

20

- Handles Airbyte protocol commands: spec, check, discover, read

21

- Processes configuration and catalog from command-line arguments

22

23

Implementation:

24

source = SourceRkiCovid()

25

launch(source, sys.argv[1:])

26

"""

27

```

28

29

### Programmatic Entry Point

30

31

Direct execution entry point for programmatic access and testing.

32

33

```python { .api }

34

# main.py entry point

35

if __name__ == "__main__":

36

run()

37

```

38

39

## Module Structure

40

41

### Main Module (`source_rki_covid.run`)

42

43

```python { .api }

44

# Module imports

45

import sys

46

from airbyte_cdk.entrypoint import launch

47

from source_rki_covid import SourceRkiCovid

48

49

def run():

50

"""Main connector execution function"""

51

```

52

53

### Entry Script (`main.py`)

54

55

```python { .api }

56

# Direct execution script

57

from source_rki_covid.run import run

58

59

if __name__ == "__main__":

60

run()

61

```

62

63

## Usage Examples

64

65

### Command Line Execution

66

67

```bash

68

# Using console script (installed via pip/poetry)

69

source-rki-covid spec

70

source-rki-covid check --config config.json

71

source-rki-covid discover --config config.json

72

source-rki-covid read --config config.json --catalog catalog.json

73

74

# Using Python module directly

75

python -m source_rki_covid.run spec

76

python main.py check --config config.json

77

```

78

79

### Programmatic Usage

80

81

```python

82

# Import and run directly

83

from source_rki_covid.run import run

84

import sys

85

86

# Override command line arguments

87

sys.argv = ['source-rki-covid', 'spec']

88

run()

89

90

# Or use the source directly

91

from source_rki_covid import SourceRkiCovid

92

from airbyte_cdk.entrypoint import launch

93

94

source = SourceRkiCovid()

95

launch(source, ['spec'])

96

```

97

98

### Integration with Airbyte CDK

99

100

```python

101

# The run function delegates to Airbyte CDK launch

102

from airbyte_cdk.entrypoint import launch

103

from source_rki_covid import SourceRkiCovid

104

105

def run():

106

source = SourceRkiCovid()

107

# launch handles:

108

# - Command parsing (spec, check, discover, read)

109

# - Configuration validation

110

# - Error handling and logging

111

# - Protocol compliance

112

launch(source, sys.argv[1:])

113

```

114

115

## Airbyte Protocol Commands

116

117

The entry point supports all standard Airbyte protocol commands:

118

119

### Spec Command

120

121

Returns the connector's configuration specification.

122

123

```bash

124

source-rki-covid spec

125

```

126

127

Returns JSON schema defining the required `start_date` parameter.

128

129

### Check Command

130

131

Tests connection to the RKI COVID-19 API.

132

133

```bash

134

source-rki-covid check --config config.json

135

```

136

137

Validates configuration and tests API connectivity.

138

139

### Discover Command

140

141

Returns the catalog of available data streams.

142

143

```bash

144

source-rki-covid discover --config config.json

145

```

146

147

Returns catalog with all 16 available streams and their schemas.

148

149

### Read Command

150

151

Performs data synchronization from the API.

152

153

```bash

154

source-rki-covid read --config config.json --catalog catalog.json [--state state.json]

155

```

156

157

Executes data sync according to the provided catalog and optional state.

158

159

## Configuration File Format

160

161

The connector expects a JSON configuration file:

162

163

```json

164

{

165

"start_date": "2023-01-01"

166

}

167

```

168

169

## Console Script Registration

170

171

The entry point is registered in `pyproject.toml`:

172

173

```toml { .api }

174

[tool.poetry.scripts]

175

source-rki-covid = "source_rki_covid.run:run"

176

```

177

178

This creates the `source-rki-covid` command when the package is installed.

179

180

## Dependencies

181

182

- **airbyte_cdk.entrypoint.launch**: Airbyte CDK entry point handler

183

- **sys**: System-specific parameters and functions for argument processing

184

- **source_rki_covid.SourceRkiCovid**: Main connector class

185

186

## Error Handling

187

188

The launch function provides comprehensive error handling:

189

190

- **Configuration Errors**: Invalid or missing configuration parameters

191

- **Connection Errors**: API connectivity issues

192

- **Schema Errors**: Invalid catalog or state files

193

- **Runtime Errors**: Unexpected exceptions during data sync

194

195

All errors are formatted according to Airbyte protocol standards and returned as structured JSON messages.