上载到Big Query时,表情符号当机 [英] Emoji crashed when uploading to Big Query

查看:91
本文介绍了上载到Big Query时,表情符号当机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我在将(使用python)EMOJI数据上传到BIG QUERY时遇到问题

Currently, I'm facing an issue with uploading (using python) EMOJI data to the BIG QUERY

这是我要上传到BQ的示例代码:

This is sample code which I'm trying to upload to BQ:

 {"emojiCharts":{"emoji_icon":"\ud83d\udc4d","repost": 4, "doc": 4, "engagement": 0, "reach": 0, "impression": 0}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\udc49","repost": 4, "doc": 4, "engagement": 43, "reach": 722, "impression": 4816}} 
 {"emojiCharts":{"emoji_icon":"\u203c","repost": 4, "doc": 4, "engagement": 0, "reach": 0, "impression": 0}} 
 {"emojiCharts":{"emoji_icon":"\ud83c\udf89","repost": 5, "doc": 5, "engagement": 43, "reach": 829, "impression": 5529}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude34","repost": 5, "doc": 5, "engagement": 222, "reach": 420, "impression": 2805}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude31","repost": 3, "doc": 3, "engagement": 386, "reach": 2868, "impression": 19122}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\udc4d\ud83c\udffb","repost": 5, "doc": 5, "engagement": 43, "reach": 1064, "impression": 7098}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude3b","repost": 3, "doc": 3, "engagement": 93, "reach": 192, "impression": 1283}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude2d","repost": 6, "doc": 6, "engagement": 212, "reach": 909, "impression": 6143}} 
 {"emojiCharts":{"emoji_icon":"\ud83e\udd84","repost": 8, "doc": 8, "engagement": 313, "reach": 402, "impression": 2681}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude18","repost": 7, "doc": 7, "engagement": 0, "reach": 8454, "impression": 56366}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude05","repost": 5, "doc": 5, "engagement": 74, "reach": 1582, "impression": 10550}} 
 {"emojiCharts":{"emoji_icon":"\ud83d\ude04","repost": 5, "doc": 5, "engagement": 73, "reach": 3329, "impression": 22206}}

问题是,大查询无法看到此表情符号(\ud83d\ude04)中的任何一个,只会以这种格式(\u203c)显示

Issues is that big query cannot see any of this emoji (\ud83d\ude04) and will display only in this format (\u203c)

即使该字段为 STRING ,它会显示2条黑面包,为什么BQ在不将表情符号显示为字符串的情况下也无法将其转换为实际的表情符号?

Even if the field is STRING it displays 2 black rombs, why BQ cannot display emoji as a string without converting it to the actual emoji?

问题:

有什么方法可以将EMOJI上载到Big Query并正确加载吗? -"将在Google Data Studio中使用"

Is there are any way to upload EMOJI to Big Query that it will load up correctly? - "will be used in Google Data Studio"

我应该手动(硬编码)将所有表情符号代码更改为可接受的格式吗?

Should I manually (hardcoded) change all emoji code the acceptable ones, which is the acceptable format?

推荐答案

用户数字"在其评论中提到:

As user 'numeral' mentions in their comment:

查看 charbase.com/1f618-unicode-face-throwing-a -kiss 您想要的是将javascript转义字符转换为实际的unicode数据.

Check out charbase.com/1f618-unicode-face-throwing-a-kiss What you want is to convert the javascript escape characters to actual unicode data.

,您需要更改表情符号的编码以使其准确地表示为一个字符:

, you need to change the encoding of the emojis for them to be accurately represented as one character:

SELECT "\U0001f604 \U0001f4b8"
--   , "\ud83d\udcb8"
--   , "\ud83d\ude04"

第二行和第3d行失败,并显示类似Illegal escape sequence: Unicode value \ud83d is invalid at [2:7]的错误,但第一行在BigQuery和Data Studio中显示正确:

The 2nd and 3d line fail with an error like Illegal escape sequence: Unicode value \ud83d is invalid at [2:7], but the first line gives the correct display in BigQuery and Data Studio:

关于此的其他想法:

这篇关于上载到Big Query时,表情符号当机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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