Azure-Samples / cdm-azure-data-services-integration

Tutorials and sample code for integrating CDM folders with Azure Data Services
MIT License
70 stars 46 forks source link

Jupyter model_json error #21

Closed datalord123 closed 4 years ago

datalord123 commented 4 years ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Tried to follow the steps with Jupyter Notebook walkthrough. Got to where i had to read in to model endpoint. In my case this was

model_endpoint = "https://cdmstoragepowerbi.blob.core.windows.net/powerbi/WideWorldImporters%2FWideWorldImporters-Sales%2Fmodel.json"

When I then tried to initialize the model_json variable in this line of code

aad_token = generate_aad_token() --->model_json = read_from_adls(endpoint = model_endpoint, auth = aad_token).json() model = CdmModel.Model.fromJson(model_json)

it failed and gave the following error. Is it because i gave it the wrong filepath endpoint? Jupyter_Error

Any log messages given by the failure

Expected/desired behavior

JSONDecodeError Traceback (most recent call last)

in 1 #model_endpoint = "https<>WWI-Sales/model.json" 2 aad_token = generate_aad_token() ----> 3 model_json = read_from_adls(endpoint = model_endpoint, auth = aad_token).json() 4 model = CdmModel.Model.fromJson(model_js ![Jupyter_Error](https://user-images.githubusercontent.com/12159949/79699656-e04e8380-825e-11ea-8736-8af506a23d9b.PNG) on) ![Jupyter_Error](https://user-images.githubusercontent.com/12159949/79699662-ea708200-825e-11ea-9326-bb11dcceac34.PNG)

c:\users\mattb\appdata\local\programs\python\python37\lib\site-packages\requests\models.py in json(self, kwargs) 888 try: 889 return complexjson.loads( --> 890 self.content.decode(encoding), kwargs 891 ) 892 except UnicodeDecodeError:

c:\users\mattb\appdata\local\programs\python\python37\lib\json__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 346 parse_int is None and parse_float is None and 347 parse_constant is None and object_pairs_hook is None and not kw): --> 348 return _default_decoder.decode(s) 349 if cls is None: 350 cls = JSONDecoder

c:\users\mattb\appdata\local\programs\python\python37\lib\json\decoder.py in decode(self, s, _w) 335 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() 339 if end != len(s):

c:\users\mattb\appdata\local\programs\python\python37\lib\json\decoder.py in raw_decode(self, s, idx) 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Windows 10

Versions

Python Kernal used was 3.6

Mention any other details that might be useful


Thanks! We'll be in touch soon.

datalord123 commented 4 years ago

azure resource manager has a different format for URL than the one that is shown as the endpoint in powerbi.

Using this endpoint works. Found in the powerbi dataflow settings section.

model_endpoint = "https://cdmstoragepowerbi.dfs.core.windows.net/powerbi/WideWorldImporters/WideWorldImporters-Sales/model.json"