You created a table, added columns for code and location, and populated it using data from another source. Now, you will learn how to query the data and get it out of the database.
While there are spatial SQL queries available to you, you can always just select the data as if it were a non-spatially enabled database so that you can use it as follows:
SELECT * FROM table
The following code shows the generic SELECT all query and the results:
cursor.execute("SELECT * from art_pieces")data=cursor.fetchall()data
The result should look as follows:
[(1, '101', '010100000025FFBFADE0A55AC06A658B6CE7934140'), (2, '102', '0101000000CC4E16E181AA5AC0D99F67B3EA8B4140'), .......,]
The first number, 1,2,n, is the id (the SERIAL PRIMARY ...