Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:47:00+00:00 2026-05-31T07:47:00+00:00

When I tried to add a new table to python/flask – class UserRemap(db.Model): name

  • 0

When I tried to add a new table to python/flask –

class UserRemap(db.Model):
    name = db.Column(db.String(40))
    email = db.Column(db.String(255))
    password = db.Column(db.String(64))
    flag = db.Column(db.String(1))

    def __init__(self, name, email, password):
        self.email = email
        self.name = name
        self.password = password
        self.flag='N'

Here is table schema –

mysql> desc UserRemap;
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| name     | varchar(40)  | NO   |     | NULL    |       |
| password | varchar(64)  | NO   |     | NULL    |       |
| email    | varchar(255) | NO   |     | NULL    |       |
| flag     | char(1)      | NO   |     | N       |       |
+----------+--------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

when i go to interactive python shell and did from myapp import db ; I get this error message,

from server import db; Traceback (most recent call last):   File
"<stdin>", line 1, in <module>   File "server.py", line 74, in
<module>
        class UserRemap(db.Model): 
  File "/usr/lib/python2.7/site-packages/Flask_SQLAlchemy-0.15-py2.7.egg/flaskext/sqlalchemy.py",
 line 467, in __init__
     DeclarativeMeta.__init__(self, name, bases, d)  
 File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.5-py2.7-linux-i686.egg/sqlalchemy/ext/declarative.py",
 line 1336, in __init__
     _as_declarative(cls, classname, cls.__dict__) 
  File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.5-py2.7-linux-i686.egg/sqlalchemy/ext/declarative.py",
 line 1261, in _as_declarative
     "table-mapped class." % cls sqlalchemy.exc.InvalidRequestError: Class <class 'server.UserRemap'> does not have a __table__ or
 __tablename__ specified and does not inherit from an existing table-mapped class.

Any thoughts on how to fix this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:47:02+00:00Added an answer on May 31, 2026 at 7:47 am

    You have to mention __tablename__ or __table__ to notify sqlalchemy for table in database.

    class UserRemap(db.Model):
        __tablename__ = 'UserRemap'
        name = db.Column(db.String(40))
        email = db.Column(db.String(255))
        password = db.Column(db.String(64))
        flag = db.Column(db.String(1))
    
        def __init__(self, name, email, password):
            self.email = email
            self.name = name
            self.password = password
            self.flag='N'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to add a new column to a table in same db, I
I tried to add new items in items table in database using linq to
This morning, when I tried to add a new ASPX page to my project,
I want to add some html in an email. I've tried the following. vFromName
I have tried this..... _doc = new FlowDocument(); Table t = new Table(); for
The steps I go through... Add new ADO.NET Entity Data Model > Generate from
i have table and i tried to add `id` int(11) NOT NULL auto_increment, to
Hello I'm trying to add new column to the Excel worksheet by command ALTER
var getAllProducts = _productService.GetAllProducts(); if (productstest.Count > 0) { model.idproduct.Add(new SelectListItem() { Value =
I tried some add to favorties JavaScript scripts.. With IE8, I get an access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.