On Sun, Oct 15, 2017 at 12:07 AM, boB Stepp wrote:
>
> #!/usr/bin/env python3
>
> """This file starts the blood pressure readings program."""
>
> import sqlite3
>
> def ensure_db(filename):
> """Open the database
On Sat, Oct 14, 2017 at 4:45 AM, Peter Otten <__pete...@web.de> wrote:
> If this is a long term project there will be changes in the schema.
> However, I don't think it is necessary to check for individual tables. You
> typically start with a few tables
>
> create table alpha
> create table beta
>
On 14Oct2017 17:44, Chris wrote:
3. It seems that nid is initialized in get_iter, Line 218 [1]
4. nid is passed as parameter to __get_iter and the other
participating funtions
5. the node with the id nid is fetched in line 222.
6. In Line 190 there's a loop.
I don't understand what increments n
On 14/10/17 16:44, Chris wrote:
> I've a question about treelib library from pip.
The list focus is the language and standard library
so if you want to ask about other code you need to
give us more context. treelib is not a commonly
discussed module, in fact this the first mention I've seen.
> T
All,
I've a question about treelib library from pip.
Treelib stores a tree and offers functions to add, delete or move
nodes. Furthermore, you can print a tree like this:
Harry
├── Harry2
├── Harry3
├── Harry4
└── Jane
├── Jane2
│ ├── Jane2.1
│ │ └── Jane2.1.1
│ ├── Jane2
boB Stepp wrote:
> On Sat, Oct 14, 2017 at 2:11 AM, boB Stepp wrote:
>
>> So I get "None" as a result if the target table has not been created
>> yet. But if I *do* create the table I want:
>>
>> py3: with open('create_sqlite3_db.sql') as f:
>> ... sql = f.read()
>> ...
>> py3: c.executescr
Yep - oracle for example has hundreds of tables which hold metadata.
for example (this will look terrible due to the length of it but if you assume
it's 3 lines; a title line, some underlining for each column and the data
itself):
SQL> select * from all_tables where owner = 'FLYNNS' and table
On 14/10/17 06:43, boB Stepp wrote:
> table if that table does not exist. Alan suggested using
> executescript() to do this. I misunderstood Alan and thought that
> this would take a filename and execute it.
c.executescript(sqlFile.read())
--
Alan G
Author of the Learn to Program web site
On Sat, Oct 14, 2017 at 12:41 PM, boB Stepp wrote:
> py3: c.executescript(sql)
>
> py3: tb_exists = "select name from sqlite_master where type='table'
> and name='BloodPressureReadings'"
> py3: tb_ck = c.execute(tb_exists).fetchone()
> py3: print(tb_ck)
> ('BloodPressureReadings',)
>
> So it is l
SQL has "CREATE TABLE IF NOT EXISTS"
so you change your instructions to
```python
import sqlite3
conn = sqlite3.connect(':memory:')
c = conn.cursor()
c.execute("""
CREATE TABLE IF NOT EXISTS BloodPressureReadings (
ReadingID INTEGER PRIMARY KEY,
Date TEXT,
Time TEXT,
SystolicBP INT
On Sat, Oct 14, 2017 at 2:11 AM, boB Stepp wrote:
> So I get "None" as a result if the target table has not been created
> yet. But if I *do* create the table I want:
>
> py3: with open('create_sqlite3_db.sql') as f:
> ... sql = f.read()
> ...
> py3: c.executescript(sql)
>
> py3: tb_exists
On Sat, Oct 14, 2017 at 1:43 AM, boB Stepp wrote:
> I am currently trying to make the following work:
>
> py3: tb_exists = c.execute('select name from sqlite_master where
> type="table"')
>
> so that I can embed this in an if statement. But it is not behaving
> quite like I hope yet. So I am s
12 matches
Mail list logo