微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pgAdmin 4 打开它时总是抛出 sqlalchemy 错误

如何解决pgAdmin 4 打开它时总是抛出 sqlalchemy 错误

当我尝试启动 pgadmin 时,它总是显示 sqlalchemy 错误。 我正在使用最新版本的 pgadmin 和 Windows 尝试使用旧版本但都有相同的问题

这是错误的跟踪本

pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:\Users\rishu\Downloads\v5\python\python.exe"
Runtime Config File: "C:\Users\rishu\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Users\rishu\Downloads\v5\web\config.py"
Webapp Path: "C:\Users\rishu\Downloads\v5\web\pgAdmin4.py"
pgAdmin Command: "C:\Users\rishu\Downloads\v5\python\python.exe -s C:\Users\rishu\Downloads\v5\web\pgAdmin4.py"
Environment: 
  - ALLUSERSPROFILE: C:\ProgramData
  - APPDATA: C:\Users\rishu\AppData\Roaming
  - CHROME_CRASHPAD_PIPE_NAME: \\.\pipe\crashpad_1536_DOVQUCMVUYAPISQG
  - CHROME_RESTART: NW.js|Whoa! NW.js has crashed. relaunch Now?|LEFT_TO_RIGHT
  - CommonProgramFiles: C:\Program Files\Common Files
  - CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
  - CommonProgramW6432: C:\Program Files\Common Files
  - COmpuTERNAME: DESKTOP-1AQJ5O2
  - ComSpec: C:\WINDOWS\system32\cmd.exe
  - DriverData: C:\Windows\System32\Drivers\DriverData
  - HOMEDRIVE: C:
  - HOMEPATH: \Users\rishu
  - LOCALAPPDATA: C:\Users\rishu\AppData\Local
  - logoNSERVER: \\DESKTOP-1AQJ5O2
  - NUMBER_OF_PROCESSORS: 4
  - OneDrive: C:\Users\rishu\OneDrive
  - OneDriveConsumer: C:\Users\rishu\OneDrive
  - OS: Windows_NT
  - Path: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\rishu\AppData\Local\Programs\Python\python39\Scripts\;C:\Users\rishu\AppData\Local\Programs\Python\python39\;C:\Users\rishu\AppData\Local\Microsoft\WindowsApps;C:\Users\rishu\AppData\Local\Programs\Microsoft VS Code\bin;C:\src\Flutter\bin;
  - PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  - PGADMIN_INT_KEY: eed0d314-16dc-4a9c-a47e-52637ac085c9
  - PGADMIN_INT_PORT: 5050
  - PGADMIN_SERVER_MODE: OFF
  - PROCESSOR_ARCHITECTURE: AMD64
  - PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 126 Stepping 5,GenuineIntel
  - PROCESSOR_LEVEL: 6
  - PROCESSOR_REVISION: 7e05
  - ProgramData: C:\ProgramData
  - ProgramFiles: C:\Program Files
  - ProgramFiles(x86): C:\Program Files (x86)
  - ProgramW6432: C:\Program Files
  - PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
  - PUBLIC: C:\Users\Public
  - SESSIONNAME: Console
  - SystemDrive: C:
  - SystemRoot: C:\WINDOWS
  - TEMP: C:\Users\rishu\AppData\Local\Temp
  - TMP: C:\Users\rishu\AppData\Local\Temp
  - USERDOMAIN: DESKTOP-1AQJ5O2
  - USERDOMAIN_ROAMINGPROFILE: DESKTOP-1AQJ5O2
  - USERNAME: rishu
  - USERPROFILE: C:\Users\rishu
  - windir: C:\WINDOWS
--------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",line 1276,in _execute_context
    self.dialect.do_execute(
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\default.py",line 608,in do_execute
    cursor.execute(statement,parameters)
sqlite3.OperationalError: duplicate column name: comment

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\rishu\Downloads\v5\web\pgAdmin4.py",line 98,in <module>
    app = create_app()
  File "C:\Users\rishu\Downloads\v5\web\pgadmin\__init__.py",line 365,in create_app
    db_upgrade(app)
  File "C:\Users\rishu\Downloads\v5\web\pgadmin\setup\db_upgrade.py",line 25,in db_upgrade
    flask_migrate.upgrade(migration_folder)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\flask_migrate\__init__.py",line 96,in wrapped
    f(*args,**kwargs)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\flask_migrate\__init__.py",line 271,in upgrade
    command.upgrade(config,revision,sql=sql,tag=tag)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\alembic\command.py",line 294,in upgrade
    script.run_env()
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\alembic\script\base.py",line 490,in run_env
    util.load_python_file(self.dir,"env.py")
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\alembic\util\pyfiles.py",line 97,in load_python_file
    module = load_module_py(module_id,path)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\alembic\util\compat.py",line 182,in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>",line 783,in exec_module
  File "<frozen importlib._bootstrap>",line 219,in _call_with_frames_removed
  File "C:\Users\rishu\Downloads\v5\web\pgadmin\setup\..\..\migrations\env.py",line 93,in <module>
    run_migrations_online()
  File "C:\Users\rishu\Downloads\v5\web\pgadmin\setup\..\..\migrations\env.py",line 86,in run_migrations_online
    context.run_migrations()
  File "<string>",line 8,in run_migrations
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\alembic\runtime\environment.py",line 813,in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\alembic\runtime\migration.py",line 561,in run_migrations
    step.migration_fn(**kw)
  File "C:\Users\rishu\Downloads\v5\web\migrations\versions\09d53fca90c7_.py",line 40,in upgrade
    db.engine.execute(
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",line 2235,in execute
    return connection.execute(statement,*multiparams,**params)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",line 1003,in execute
    return self._execute_text(object_,multiparams,params)
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",line 1172,in _execute_text
    ret = self._execute_context(
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",line 1316,in _execute_context
    self._handle_dbapi_exception(
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",line 1510,in _handle_dbapi_exception
    util.raise_(
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\util\compat.py",in raise_
    raise exception
  File "C:\Users\rishu\Downloads\v5\python\lib\site-packages\sqlalchemy\engine\base.py",parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: comment
[sql: ALTER TABLE server ADD COLUMN comment TEXT(1024)]
(Background on this error at: http://sqlalche.me/e/13/e3q8)

我已经检查过这个(http://sqlalche.me/e/13/e3q8)并尝试重新安装很多次都无法解决问题

请有人帮忙解决这个问题

解决方法

通过删除整个 pgadmin 文件夹解决了我的问题 这是路径

"C:\Users\<USERNAME>\AppData\Roaming\pgadmin"

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。