From 2bf45f888a2f3e4cf985ebd90af284612feb0e2a Mon Sep 17 00:00:00 2001 From: Samuel Montgomery-Blinn Date: Tue, 3 Dec 2024 20:42:00 -0500 Subject: [PATCH] Update README.md Expands this example to include a normal column, inserting, and querying. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 3688acff..604c10b0 100644 --- a/README.md +++ b/README.md @@ -121,8 +121,17 @@ users_table = sqlalchemy.Table( server_default=user_id_seq.next_value(), primary_key=True, ), + sqlalchemy.Column( + 'name', + sqlalchemy.String(30) + ) ) metadata.create_all(bind=engine) +with engine.begin() as conn: + conn.execute(sqlalchemy.text("insert into users(name) values(:name)"), [{"name":"Sam"},{"name":"Dave"}]) +with engine.connect() as conn: + for row in conn.execute(sqlalchemy.text("select * from users")): + print(row) ``` ### Pandas `read_sql()` chunksize