Teradata:如何删除字符\ x00& \ x02来自数据

发布于 2025-01-26 01:41:05 字数 774 浏览 2 评论 0原文

我正在从Teradata数据库中加载数据,例如:

df = spark.read.format("jdbc").option("url", "jdbc:teradata://url_of_teradata_db/MAYBENULL=ON,TYPE=FASTEXPORT,charset=ASCII").option("dbtable", "({}) as subq".format(req)).option("driver", "com.teradata.jdbc.TeraDriver").option("user", my_user).option("password", my_password).load()

在我的数据中,我得到了不必要的字符,例如:\ x00& \ x02 ...

如何正确读取这些字符 *到我的spark.read.format

我发现 nullbyteprefix ,但我不确定如何使用

编辑:

我的查询查询真的很简单:

SELECT MY_ROW FROM MY_TABLE

我问Teradata有关此列的更多信息,我得到了:

| Column Name     | Type | Nullable | Format | Max length | 
| My_TABLE.MY_ROW | CV   | N        | X(100) | 100        |

I am loading data from a teradata database like:

df = spark.read.format("jdbc").option("url", "jdbc:teradata://url_of_teradata_db/MAYBENULL=ON,TYPE=FASTEXPORT,charset=ASCII").option("dbtable", "({}) as subq".format(req)).option("driver", "com.teradata.jdbc.TeraDriver").option("user", my_user).option("password", my_password).load()

In my data, I get unwanted character like: \x00 & \x02 ...

How can I correctly read those characters *into my spark.read.format?

I found the NULLBYTEPREFIX but I am not sure how to use it

EDIT :

my query query is really simple:

SELECT MY_ROW FROM MY_TABLE

I ask teradata more information about this column and I get:

| Column Name     | Type | Nullable | Format | Max length | 
| My_TABLE.MY_ROW | CV   | N        | X(100) | 100        |

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我要还你自由 2025-02-02 01:41:05

您可以检查数据库列的字符集,并将这些字符设置添加到上面的查询中吗?

您可以引用此 link ,如果您无法理解Teradata中设置的字符。

Could you check character set of database columns and add those character set into your above query.

You can refer this link, if you unable to understand the character set in teradata.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文