You are viewing documentation about an older version (1.3.0). View latest version

snowflake.snowpark.Session.table¶

Session.table(name: str | Iterable[str]) → Table[source]¶

Returns a Table that points the specified table.

Parameters:
  • name – A string or list of strings that specify the table name or fully-qualified object identifier (database name, schema name, and table name).

  • Note – If your table name contains special characters, use double quotes to mark it like this, session.table('"my table"'). For fully qualified names, you need to use double quotes separately like this, session.table('"my db"."my schema"."my.table"'). Refer to Identifier Requirements.

Examples:

>>> df1 = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"])
>>> df1.write.save_as_table("my_table", mode="overwrite", table_type="temporary")
>>> session.table("my_table").collect()
[Row(A=1, B=2), Row(A=3, B=4)]
>>> current_db = session.get_current_database()
>>> current_schema = session.get_current_schema()
>>> session.table([current_db, current_schema, "my_table"]).collect()
[Row(A=1, B=2), Row(A=3, B=4)]
Copy