Cosmos DB + pyDocumentDB + Databricks [英] Cosmos DB + pyDocumentDB + Databricks

查看:89
本文介绍了Cosmos DB + pyDocumentDB + Databricks的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用pyDocumentDB和使用Cosmos DB的Databricks时,我的行为很奇怪.我正在尝试查询集合,连接运行良好,但是在获取结果时遇到了一些麻烦.如果我以一般"方式查询,我会得到结果...

I've got a strange behaviour with pyDocumentDB and Databricks with Cosmos DB . I'm trying to query a collection, connection goes well, but I'm having a little troubles fetching results. If I query in a "general" way I obtain results...

但是,例如,当我尝试获取"tweet"中的"source"字段时,我只会得到一个空结果

But when I try to fetch, for example, the 'source' field inside the 'tweet' I obtain only an empty result

我查询了结构"集合,并检查了源"字段的路径.该字段存在

I queried for collection 'structure' and check the path to the 'source' field. The field exists

我已经检查了SELECT语句中所有可能的路径组合,以恢复源"字段.无返回数据. Cosmos DB是在选择MongoDB API接口的情况下创建的.该选择是否会干扰SQL语句?

I've check all possible path combinations in the SELECT sentence to recover the 'source' field. None returns data. Cosmos DB was created with MongoDB API interface selected. Could that selection being interfering with the SQL sentences?.

谢谢.

推荐答案

这是因为Mongo API.您可以看到使用$ t/$ v格式返回的结果.这就是Mongo API存储到Cosmos DB中的内容,以保留其所需的所有Mongo类型信息.

It is because of Mongo API. You can see the results that are returned is using the $t/$v format. That is what the Mongo API stores into Cosmos DB to keep all the Mongo type information it needs.

尝试:

SELECT TOP 10 twttr["$v"].tweet["$v"].source FROM twttr

(请注意,$ v在没有["$ v"]的情况下无效,因为$是SQL语言中的特殊字符)

(Note that $v is not valid without the ["$v"] because $ is a special character in the SQL language)

这篇关于Cosmos DB + pyDocumentDB + Databricks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆