On 19/04/17 03:21, Marilyn Davis wrote:
> connection.execute("SELECT * FROM BRIGHTEST")
>
> returns a , not a regular python
> sequence.
Pretty much everything inn SQL land uses cursor objects.
It's why best practice creates an explicit cursor for
executing statements rather than the impl8ici
Thank you Alan, Steven and Peter,
So, this call:
connection.execute("SELECT * FROM BRIGHTEST")
returns a , not a regular python
sequence. I did not know that. And, the connection must still be alive
when you iterate it.
That is a very important tidbit of info.
The fix is to listify the Curso
Marilyn Davis wrote:
> #!/usr/bin/env python3
> """
> Hello Tutors,
>
> I can't figure out why the FillWithStars() function puts Canopus in the db
> twice.
>
> What am I missing?
>
> Thank you for any help.
>
> Marilyn Davis
>
> p.s. That Reset(db_name) is in there so that you can run it over
I made one more diagnostic change to your script, changing the
FillWithStars function to this:
def FillWithStars():
with sqlite3.connect("stars.db") as connection:
connection.executescript("""
CREATE TABLE brightest(
name,
constellation,
On Mon, Apr 17, 2017 at 04:36:50PM -0700, Marilyn Davis wrote:
> #!/usr/bin/env python3
> """
> Hello Tutors,
>
> I can't figure out why the FillWithStars() function puts Canopus in the db
> twice.
Good question. And thank you for providing a really well-written,
simple, clear script that we ca
On 18/04/17 00:36, Marilyn Davis wrote:
> #!/usr/bin/env python3
> """
> Hello Tutors,
>
> I can't figure out why the FillWithStars() function puts Canopus in the db
> twice.
>
> What am I missing?
I don;t know but I converted your script into the more
conventional form and it worked. it was the
#!/usr/bin/env python3
"""
Hello Tutors,
I can't figure out why the FillWithStars() function puts Canopus in the db
twice.
What am I missing?
Thank you for any help.
Marilyn Davis
p.s. That Reset(db_name) is in there so that you can run it over and over
if you want.
---
"""
import os, sqlite3