File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change
1
+ [metadata]
2
+ description-file = README.md
Original file line number Diff line number Diff line change 1
- from .main import write_records , write_bookmark
1
+ from .main import write_records , write_bookmark , write_schema
Original file line number Diff line number Diff line change @@ -16,21 +16,27 @@ def _write_headers():
16
16
_writeline ('--' )
17
17
_headers_written = True
18
18
19
- def write_records (stream_name , schema , records ):
19
+ def write_records (stream_name , records ):
20
20
_write_headers ()
21
21
for record in records :
22
22
_writeline (json .dumps ({'type' : 'RECORD' ,
23
23
'stream' : stream_name ,
24
- 'schema' : schema ,
25
24
'record' : record }))
26
25
26
+ def write_schema (stream_name , schema ):
27
+ _write_headers ()
28
+ _writeline (json .dumps ({'type' : 'SCHEMA' ,
29
+ 'stream' : stream_name ,
30
+ 'schema' : schema }))
31
+
27
32
def write_bookmark (value ):
28
33
_write_headers ()
29
34
_writeline (json .dumps ({'type' : 'BOOKMARK' ,
30
35
'value' : value }))
31
36
32
37
33
38
if __name__ == "__main__" :
39
+ write_schema ('test' ,
40
+ {'properties' :{'id' : {'type' : 'string' , 'key' : True }}})
34
41
write_records ('test' ,
35
- {'properties' :{'id' : {'type' : 'string' , 'key' : True }}},
36
42
[{'id' : 'b' }, {'id' :'d' }])
You can’t perform that action at this time.
0 commit comments