Forum Archive

Pythonista SQLAlchemy / psycopg2

DavinE

Hey Guys,

i Have a question about SQLAlchemy.

SQLAlchemy is installed but when i run this code to test it i get an error..:

from sqlalchemy import create_engine
engine = create_engine('postgresql://user:pass@IP:PORT/sqlalchemy')

an this i get:

Traceback (most recent call last):
  File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/UI/Test Ordner/test.py", line 2, in <module>
    engine = create_engine('postgresql://user:pass@IP:PORT/sqlalchemy')
  File "/var/containers/Bundle/Application/2952696D-C724-455F-8983-F13D0477091A/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/sqlalchemy/engine/__init__.py", line 347, in create_engine
    return strategy.create(*args, **kwargs)
  File "/var/containers/Bundle/Application/2952696D-C724-455F-8983-F13D0477091A/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/sqlalchemy/engine/strategies.py", line 75, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/var/containers/Bundle/Application/2952696D-C724-455F-8983-F13D0477091A/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 423, in dbapi
    import psycopg2
ModuleNotFoundError: No module named 'psycopg2'

need i to reinstall SQLAlchemy ?

JonB

@DavinE https://forum.omz-software.com/topic/3631/error-when-running-pip-install-psycopg2

You cannot install psycopg2 on pythonista. You may be able to use pg8000.

DavinE

Is it Possible to Update SQLAlchemy to 1.4.x the Version that is installed is 0.9.x.....

ccc

I do not think that it is possible to update dependencies that are built into Pythonista.

I believe that Pyto is more flexible in this regard but I have not done much experimentation.

DavinE

okay Thanks @ccc