File tree 1 file changed +7
-3
lines changed
apps/etl/transform/sources 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
3
+ from pystac_monty .sources .common import DataType , File
3
4
from pystac_monty .sources .glide import GlideDataSource , GlideTransformer
4
5
5
6
from apps .etl .models import ExtractionData
6
7
from apps .etl .transform .sources .handler import BaseTransformerHandler
8
+ from apps .etl .utils import write_into_temp_file
7
9
from main .celery import app
8
10
9
11
@@ -13,10 +15,12 @@ class GlideTransformHandler(BaseTransformerHandler[GlideTransformer, GlideDataSo
13
15
14
16
@classmethod
15
17
def get_schema_data (cls , extraction_obj ):
16
- with extraction_obj .resp_data .open () as file_data :
17
- data = file_data .read ()
18
+ with extraction_obj .resp_data .open ("rb" ) as f :
19
+ data = f .read ()
20
+ data_file = write_into_temp_file (data )
21
+ data_source = {"source_url" : extraction_obj .url , "source_data" : File (path = data_file .name , data_type = DataType .FILE )}
18
22
19
- return cls .transformer_schema (source_url = extraction_obj . url , data = data )
23
+ return cls .transformer_schema (data_source )
20
24
21
25
@staticmethod
22
26
@app .task
You can’t perform that action at this time.
0 commit comments