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

extract columns from given schema same as PRAGMA table_info #506

Open
AliM1988 opened this issue Jul 5, 2024 · 0 comments
Open

extract columns from given schema same as PRAGMA table_info #506

AliM1988 opened this issue Jul 5, 2024 · 0 comments

Comments

@AliM1988
Copy link

AliM1988 commented Jul 5, 2024

Suppose we have a new schema as a text. How to extract columns from new schema same as PRAGMA table_info?

Actually I want to compare new schema (provided as a text string) with existing one in current database.

Sample:

new_schema='''
CREATE TABLE sqlite_schema(
  type text,
  name text,
  tbl_name text,
  rootpage integer,
  sql text
)
'''

parser = sql_metadata.Parser(new_schema)
columns = parser.columns

parser.columns just returns columns name, but I need a format same as PRAGMA table_info:
(cid, name, type, notnull, dflt_value, pk)

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