2

I am new to sqlalchemy and trying to create tables in mysql.Created a virtual environment and executed below commands. pip3 install sqlalchemy pip3 install sqlalchemy-migrate

Python version- 3.6.4 but when I try to execute the command "python models.py" on terminal it pops an error

File "models.py", line 1, in <module>
    from sqlalchemy import Table, Column, Integer, MetaData, ForeignKey, DateTime, Float, BigInteger, String, func
ModuleNotFoundError: No module named 'sqlalchemy'
from sqlalchemy import Table, Column, Integer, MetaData, ForeignKey, DateTime, Float, BigInteger, String, func

import helper.connection_util as connection_util

metadata = MetaData()

# employee TABLE
employee = Table('employee', metadata,
                    Column('employee_id', Integer, primary_key=True),
                    Column('employee_name', String(100)),
                    Column('employee_designation', String(100)),

metadata.create_all(connection_util.get_connection())
DennisLi
  • 3,915
  • 6
  • 30
  • 66
Suchitra
  • 77
  • 1
  • 2
  • 5

1 Answers1

7

It sounds like sqlalchemy did not install. You can try using sudo pip3 install sqlalchemy.

You can confirm the install by running python in interactive mode and using the following commands:

$ python3
>>> import sqlalchemy
>>> sqlalchemy.__version__

This should give you the version of sqlalchemy you have.

mageliz
  • 146
  • 4