[2024] Snowflake Cortex — TRANSLATE Function

This function translates the given input text from one supported language to another.

Syntax

SNOWFLAKE.CORTEX.TRANSLATE(text, source_language, target_language)

where

Text is a string containing the text to be translated.

Source_language is a string specifying the language code for the language the text is currently in.

If the source language code is an empty string, '', the source language is automatically detected.

Target_language is a string specifying the language code into which the text should be translated.

Currently the below list of languages are supported:

Function Output

The function returns a string containing a translation of the original text into the target language.

Usage

You can use it you ask a prompt based on the input by the user OR you can also use your data which resides inside snowflake table.

This is a translation of a bad experience of a passenger travelling from Delhi to Vancouver.

SELECT 
SNOWFLAKE.CORTEX.TRANSLATE(
$$
I recently had a very disappointing and stressful experience on my flight from Delhi (DEL) to Vancouver (YVR). The whole journey was plagued with issues and it left me with a bitter taste in my mouth.

To begin with, the flight schedule kept changing multiple times before my departure date. This caused a lot of inconvenience as I had to keep rearranging my plans and make last-minute changes. The lack of proper communication about these changes only added to my frustration.

On the day of my flight, I arrived at the airport to find out that my flight was delayed by four hours. This was not only frustrating but also exhausting as I had a connecting flight to catch in Vancouver. Despite the long delay, there was no proper explanation or updates provided by the airline staff.

When I finally boarded the flight, I was shocked to see the condition of the aircraft. The seats were old and uncomfortable, and there was a musty smell in the cabin. Additionally, the in-flight entertainment system was not working, which made the long journey even more unbearable.

The worst part of the flight was the food. It was tasteless and poorly prepared. To make matters worse, the flight attendants were rude and unaccommodating when I requested a vegetarian meal, which I had pre-booked. I had to settle for some fruits and crackers for my entire meal.

To top it all off, my baggage did not arrive with me at YVR. It was frustrating to have to wait for hours at baggage claim only to find out that my luggage was still in Delhi. I had to file a report and wait for two days before my baggage was finally delivered to my hotel.

Overall, my experience with this flight was highly disappointing. The constant delays, poor service, uncomfortable seats, and lost baggage left me stressed and exhausted. I expected much better from this airline, especially for the price I paid for my ticket. I would not recommend this airline to anyone and I will definitely think twice before booking another flight with them.
$$,
'',
'ja'

);

The below is the output:

私は最近、ホテルに到着したオーバーボールで、旅行のリクエストをすべてしました。このベジタリアンと旅行のレポートは、間違いなく私の旅行のための非常にストレスに満ちたサービスと、特にデリー (DEL) からバンクーバー (YVR) へのフライトの定期的な荷物の待機が遅れたとき、この航空券の予約が非常に期待されていたため、旅行の経験がまったくありませんでした。このフライトは、旅行の前で非常にストレスを感じたもので

About Me:

Hi there! I am Divyansh Saxena

I am an experienced Cloud Data Engineer with a proven track record of success in Snowflake Data Cloud technology. Highly skilled in designing, implementing, and maintaining data pipelines, ETL workflows, and data warehousing solutions. Possessing advanced knowledge of Snowflake’s features and functionality, I am a Snowflake Data Superhero & Snowflake Snowpro Core SME. With a major career in Snowflake Data Cloud, I have a deep understanding of cloud-native data architecture and can leverage it to deliver high-performing, scalable, and secure data solutions.

Follow me on Medium for regular updates on Snowflake Best Practices and other trending topics:

Also, I am open to connecting all data enthusiasts across the globe on LinkedIn:

https://www.linkedin.com/in/divyanshsaxena/

--

--