Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%sqlcmd columns outputs sql.inspect.Columns #43

Open
prakashperiasamy opened this issue May 3, 2023 · 0 comments
Open

%sqlcmd columns outputs sql.inspect.Columns #43

prakashperiasamy opened this issue May 3, 2023 · 0 comments

Comments

@prakashperiasamy
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant