Python - How to print Sqlite table
Question: Here I have some simple python code to query a sqlite3 database.

    
    
    import sqlite3 as lite
    
    conn = lite.connect('db/posts.db')
    cur = conn.cursor()
    
    def get_posts():
        cur.execute("SELECT * FROM Posts")
        print(cur.fetchall())
    
    get_posts()
    

I have already created the table `Posts`. When I run this I get no errors, and
it just prints out `[]`. I know that the table Posts isn't empty, I created it
in a REPL. Why is this not working?

Any help is appreciated!


Answer: Turns out I just forgot to use `conn.commit()`. Hope this helps someone.

