Tables are duplicated

3 views
Skip to first unread message

Alan UK

unread,
Feb 21, 2026, 11:41:10 AM (5 days ago) Feb 21
to phpliteadmin
Hi. On my first App. It was going well when suddenly two of my tables were duplicated in phpliteadmin.
  • SQLite version: 3.31.1
    SQLite extension [?]: PDO
    PHP version: 7.4.33
    phpLiteAdmin version: 1.9.8.2
  • Windows 10 Prof x64
  • Abyss Web Server X1 (v 2.9.3.6)  local server
  • Python3 v3.13.12
  • Flask 3.1.3
  • Werkzeug 3.1.6

My table was Helpline and the duplicate is help_line.  help_line has the same columns but no data. My python app is now showing no data so must be using the duplicate (I can add a record to the  duplicate and it appears).

The structure in  phpliteadmin for Helpline
Query used to create this table
  • CREATE TABLE 'HelpLine' ('id' INTEGER PRIMARY KEY,'trans_id' TEXT NOT NULL,'line_no' INTEGER NOT NULL, 'style' TEXT, 'text' TEXT )
and help_line is
  • CREATE TABLE help_line ( id INTEGER NOT NULL, trans_id VARCHAR(3), line_no INTEGER, style VARCHAR(150), text VARCHAR(150), PRIMARY KEY (id) )
Note that text is key rather than id despite  phpliteadmin GUI showing 
  • phpliteadmin help_line.jpg
Note a file scan of my app folders finds no occurrence of help_line in my code.

My model defn is 
  • phpliteadmin models.jpg
I do have a query
  • helplines = HelpLine.query.filter(HelpLine.trans_id == 'Z00').order_by(HelpLine.line_no)

I hope there is enough info here to help me solve this. 
Many thanks
Alan

Alan UK

unread,
Feb 21, 2026, 2:04:30 PM (5 days ago) Feb 21
to phpliteadmin
I **think** I've found the problem.

I presumed that to create a new table I would 1st define it in the database using a tool like phpLiteAdmin and then in flask-sqlalchemy define the same structure in the models.

I deleted the database and the demo app __init__.py module then recreates it from a backup folder. When I then opened the database in phpLiteAdmin  it had now been automatically populated with my new tables defined in Models except it did not use the Models name of "Helpline" but the "help_line" name.

So it seems that I have to leave the actual table names and definitions in the database to flask-sqlalchemy even though my Models definition is using another naming format.

The danger of taking pre-existing code. In my defence ;) the example code supported a 2 hour training video that I did watch. I don't know if this was described or I can't remember it.
Reply all
Reply to author
Forward
0 new messages