You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
Objective: Using the %sqlcmd columns I like to access the column names (as a dataframe or series or list) of tables in a database.
What I did:
Cell#1: %sql USE DATABASE {DB Name} %sqlcmd columns --table {Table Name} --schema {Schema Name}
Cell#2: (to capture the previous result) df = _
Cell#3: (to know the data type of the result) type(df) output:sql.inspect.Columns
Hence I'm not able to apply any methods or functions to convert this into a dataframe or series or list.
Q1: Is there a way I can access the output as a dataframe instead of sql.inspect.Columns
Q2: Is there a way to consolidate cell#1 & 2. Is there a way to directly store the output of %sqlcmd into a variable directly.
The text was updated successfully, but these errors were encountered:
Hi
Objective: Using the
%sqlcmd columns
I like to access the column names (as a dataframe or series or list) of tables in a database.What I did:
Cell#1:
%sql USE DATABASE {DB Name} %sqlcmd columns --table {Table Name} --schema {Schema Name}
Cell#2: (to capture the previous result)
df = _
Cell#3: (to know the data type of the result)
type(df)
output:
sql.inspect.Columns
Hence I'm not able to apply any methods or functions to convert this into a dataframe or series or list.
Q1: Is there a way I can access the output as a dataframe instead of sql.inspect.Columns
Q2: Is there a way to consolidate cell#1 & 2. Is there a way to directly store the output of %sqlcmd into a variable directly.
The text was updated successfully, but these errors were encountered: