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

How can I check schema of SQLLEX? #10

Open
kingabzpro opened this issue May 14, 2021 · 5 comments
Open

How can I check schema of SQLLEX? #10

kingabzpro opened this issue May 14, 2021 · 5 comments
Labels
discussion Questions about implementation details, help or support feature New feature request good first issue Good for newcomers

Comments

@kingabzpro
Copy link
Contributor

No description provided.

@v1a0
Copy link
Owner

v1a0 commented May 14, 2021

Hey, kingabzpro, sorry but what do you mean under "check schema of SQLLEX"?

@kingabzpro
Copy link
Contributor Author

When I create a relational database with a foreign key, I want to see some sort of diagram or relation how my all tables are connected.

@v1a0
Copy link
Owner

v1a0 commented May 14, 2021

Hmm... I guess right now there is no such method in SQLite3x for this case. If sqlite3 ( from the box) have something for this case, you can use db.execute() and run any sql-script.

For example:

table_sql = db.execute("SELECT sql FROM sqlite_schema WHERE name = 'users';")
print(table_sql)
CREATE TABLE 'users'  (
username TEXT NOT NULL,
group_id INTEGER,
FOREIGN KEY (group_id) REFERENCES groups (group_id)
)

If you have any ides how to make something like that tell me.

UPD:
sqllex v0.1.8.3 released

pip install sqllex -U

@kingabzpro
Copy link
Contributor Author

I think I am busy in Data Analysis part, I will come to you about schema soon,
image

I think it should show me names of tables available in the database but it shows the directory.

@kingabzpro
Copy link
Contributor Author

I think I am busy in Data Analysis part, I will come to you about schema soon,
image

I think it should show me names of tables available in the database but it shows the directory.

I found it

academic_db.execute("SELECT name FROM sqlite_master WHERE type='table';")

@v1a0 v1a0 added feature New feature request good first issue Good for newcomers discussion Questions about implementation details, help or support labels May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions about implementation details, help or support feature New feature request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants