Error when trying to use pymysql with sqlalchemy sre_constants.error: nothing to repeat
Question: I tried to use pymsql with sqlalchemy using this code :

    
    
        from sqlalchemy import create_engine
        engine = create_engine("mysql+pymsql://root:@localhost/pydb")
        conn = engine.connect()
        

and this exception is raised here is the full stack trace :

    
    
        Traceback (most recent call last):
          File "D:\Parser\dal__init__.py", line 3, in 
            engine = create_engine("mysql+pymsql://root:@localhost/pydb")
          File "C:\Python33\lib\site-packages\sqlalchemy-0.9.2-py3.3.egg\sqlalchemy\engine__init__.py", line 344, in create_engine
          File "C:\Python33\lib\site-packages\sqlalchemy-0.9.2-py3.3.egg\sqlalchemy\engine\strategies.py", line 48, in create
          File "C:\Python33\lib\site-packages\sqlalchemy-0.9.2-py3.3.egg\sqlalchemy\engine\url.py", line 163, in make_url
          File "C:\Python33\lib\site-packages\sqlalchemy-0.9.2-py3.3.egg\sqlalchemy\engine\url.py", line 183, in _parse_rfc1738_args
          File "C:\Python33\lib\re.py", line 214, in compile
            return _compile(pattern, flags)
          File "C:\Python33\lib\re.py", line 281, in _compile
            p = sre_compile.compile(pattern, flags)
          File "C:\Python33\lib\sre_compile.py", line 498, in compile
            code = _code(p, flags)
          File "C:\Python33\lib\sre_compile.py", line 483, in _code
            _compile(code, p.data, flags)
          File "C:\Python33\lib\sre_compile.py", line 75, in _compile
            elif _simple(av) and op is not REPEAT:
          File "C:\Python33\lib\sre_compile.py", line 362, in _simple
            raise error("nothing to repeat")
        sre_constants.error: nothing to repeat
        


Answer: Drop the `:` from your connection string after your username. It should
instead be `mysql+pymsql://root@localhost/pydb`

