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

  • Home
  • SEARCH
  • 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 8164359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:18:01+00:00 2026-06-06T19:18:01+00:00

I installed alembic 0.3.4, sqlalchemy, SQLite version 3.7.4, and upgraded SQLAlchemy 0.6.4 to SQLAlchemy

  • 0

I installed alembic 0.3.4, sqlalchemy, SQLite version 3.7.4, and upgraded SQLAlchemy 0.6.4 to SQLAlchemy 0.7 or greater from my ubuntu.
I followed the instructions linked here:

Now I am testing: Auto Generating Migrations
I have created a package: schemas, and a package marker under schemas: init.py
with one line defined:

__all__ = ["teacher"]

I also created a module file: dbmodel.py in schemas directory with below content

Base = declarative_base()
class teacher(Base):
      __tablename__ = 'teacher' 
      id = Column(Integer, primary_key=True)
      name = Column(String)
      department = Column(String)

By the way, I have a sqlite db created, and it is running fine for doing some test before Auto Generating Migrations. I configured the env.py file. There are two lines added:

from schemas.dbmodel import Base
target_metadata = Base.metadata

Then I run:

alembic revision --autogenerate -m "Added teacher table"

but still get error:

Traceback (most recent call last):
File "/usr/local/bin/alembic", line 9, in <module>
    load_entry_point('alembic==0.3.4', 'console_scripts', 'alembic')()
  File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.4-py2.7.egg/alembic/config.py", line 229, in main
    **dict((k, getattr(options, k)) for k in kwarg)
  File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.4-py2.7.egg/alembic/command.py", line 93, in revision
    script.run_env()
  File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.4-py2.7.egg/alembic/script.py", line 188, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/local/lib/python2.7/dist-packages/alembic-0.3.4-py2.7.egg/alembic/util.py", line 185, in load_python_file
    module = imp.load_source(module_id, path, open(path, 'rb'))
  File "alembic/env.py", line 20, in <module>
    from schemas.dbmodel import Base
ImportError: No module named schemas.dbmodel

I don’t know why it is so difficult for me to test a simple example using alembic. I just want to import my application data model into the physical database model. Is that so complicated? Thanks. Please somebody who knows alembic gives us a simple exaple step by step. I guess more people will get benefit from that.

  • 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-06-06T19:18:02+00:00Added an answer on June 6, 2026 at 7:18 pm

    I also found that Alembic couldn’t find my model modules. As a workaround, I found that, by adding the following to my env.py before importing my models, I could force it to work:

    import os, sys
    sys.path.append(os.getcwd())
    

    This is probably not the best solution, but it got Alembic to autogenerate my migrations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Installed Ubuntu 11.10, removed Ruby1.8.7 completely, and then installed Ruby1.9.2-p290 from source, followed by
Installed Mono 2.4 on Ubuntu using the instructions here: http://www.nabble.com/forum/PrintPost.jtp?post=22841086 When I run xsp
I installed java from a binary package (bin format). Now I want to know
I installed qt libraries from ubuntu software centr and and installed qt creator from
I installed ActiveReports from their site. The version was labeled as .NET 2.0 build
I installed Python 3.x (besides Python 2.x on Ubuntu) and slowly started to pair
Installed Visual Studio Web Developer 2010 Express from the ISO available from this page:
I installed Dreamweaver and when I was downloading the dependent files from my website,
I installed the playframework fbconnect module (version 0.6). I keep getting the following error.
Installed PEAR and followed the directions on http://www.phpunit.de/manual/current/en/installation.html : pear config-set auto_discover 1 pear

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.