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

Document that running db.transform() tidies up the schema indentation #564

Closed
simonw opened this issue Jul 3, 2023 · 0 comments
Closed

Comments

@simonw
Copy link
Owner

simonw commented Jul 3, 2023

... and it turns out running .transform() with no arguments still fixes the format of the schema!

>>> db["log"].add_column("foo", str)
<Table log (id, name2, age, weight, foo)>
>>> db["log"].add_column("bar", str)
<Table log (id, name2, age, weight, foo, bar)>
>>> db["log"].add_column("baz", str)
<Table log (id, name2, age, weight, foo, bar, baz)>
>>> print(db["log"].schema)
CREATE TABLE "log" (
   [id] INTEGER PRIMARY KEY,
   [name2] TEXT,
   [age] INTEGER,
   [weight] FLOAT
, [foo] TEXT, [bar] TEXT, [baz] TEXT)
>>> db["log"].transform()
<Table log (id, name2, age, weight, foo, bar, baz)>
>>> print(db["log"].schema)
CREATE TABLE "log" (
   [id] INTEGER PRIMARY KEY,
   [name2] TEXT,
   [age] INTEGER,
   [weight] FLOAT,
   [foo] TEXT,
   [bar] TEXT,
   [baz] TEXT
)

Originally posted by @simonw in simonw/llm#65 (comment)

@simonw simonw closed this as completed in 2c12c01 Jul 22, 2023
simonw added a commit that referenced this issue Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant