English 中文(简体)
如何用雪地悬浮从舞台文件读出?
原标题:Snowpark- How to read a from a stage file using snowpark sesssion?
I have multiple file in stage and want to read the contents from it. For example, i have below file in the stage- single file for this case from snowfake.snowpark.context import get_active_session session = get_active_session() location = "@data_stage/emp_data/file_path/emp.paraquet" df = session.read.paraquet(location) df.show() this file have 3 column name and in the result only it returning the empty row value . Is this right approach to retrieve the contents from the stage file in snowpark?
问题回答
I notice that you have a spelling issue in your code (you re using "paraquet" in place of "parquet"). I m assuming that s not the issue, as it would error, but just want to make you aware of that. If the files in your stage are named "paraquet", they won t be read properly. This is the standard way to read from a parquet in a stage. I am able to use your syntax almost exactly to read from parquet files from one of my own S3 stages. Alternatively, you could use session.sql and a select statement to see what is in your staged file: select_statement = ("SELECT * FROM @data_stage/emp_data/file_path/emp.parquet") df = session.sql(select_statement).collect_nowait().to_df() df.show()




相关问题
Get webpage contents with Python?

I m using Python 3.1, if that helps. Anyways, I m trying to get the contents of this webpage. I Googled for a little bit and tried different things, but they didn t work. I m guessing that this ...

What is internal representation of string in Python 3.x

In Python 3.x, a string consists of items of Unicode ordinal. (See the quotation from the language reference below.) What is the internal representation of Unicode string? Is it UTF-16? The items ...

What does Python s builtin __build_class__ do?

In Python 3.1, there is a new builtin function I don t know in the builtins module: __build_class__(...) __build_class__(func, name, *bases, metaclass=None, **kwds) -> class Internal ...

what functional tools remain in Python 3k?

I have have read several entries regarding dropping several functional functions from future python, including map and reduce. What is the official policy regarding functional extensions? is lambda ...

Building executables for Python 3 and PyQt

I built a rather simple application in Python 3.1 using PyQt4. Being done, I want the application to be distributed to computers without either of those installed. I almost exclusively care about ...

热门标签