{"id":10253,"library":"sqlalchemy-pgspider","title":"SQLAlchemy PGSpider Dialect","description":"SQLAlchemy-PGSpider is a Python library that provides a dialect for SQLAlchemy, enabling it to connect to PGSpider databases. As of version 0.1.0, it offers fundamental connectivity and query execution. It is a new project in active development, likely following a release cadence tied to upstream PGSpider and SQLAlchemy updates.","status":"active","version":"0.1.0","language":"en","source_language":"en","source_url":"https://github.com/pgspider/sqlalchemy-pgspider","tags":["sqlalchemy","database","pgspider","dialect","postgresql"],"install":[{"cmd":"pip install sqlalchemy-pgspider","lang":"bash","label":"Install core package"},{"cmd":"pip install psycopg2-binary","lang":"bash","label":"Install PostgreSQL driver (recommended)"}],"dependencies":[{"reason":"Core dependency for any SQLAlchemy dialect.","package":"SQLAlchemy","optional":false},{"reason":"A PostgreSQL driver is required for SQLAlchemy to establish a connection to a PGSpider database. 'psycopg2-binary' is a common choice for simplicity.","package":"psycopg2-binary","optional":true}],"imports":[{"note":"The `sqlalchemy-pgspider` package registers the 'pgspider' dialect with SQLAlchemy upon installation. You typically don't import symbols directly from `sqlalchemy_pgspider`; instead, you use `create_engine` with a 'pgspider://' URI.","symbol":"create_engine","correct":"from sqlalchemy import create_engine"}],"quickstart":{"code":"from sqlalchemy import create_engine, text\nimport os\n\n# Replace with your PGSpider connection details\n# For example: \"pgspider://user:password@host:port/database\"\nPGSPIDER_CONN_STR = os.environ.get('PGSPIDER_CONN_STR', 'pgspider://postgres:password@localhost:5432/pgspider_db')\n\ntry:\n    engine = create_engine(PGSPIDER_CONN_STR)\n\n    with engine.connect() as connection:\n        result = connection.execute(text(\"SELECT 1\"))\n        print(f\"PGSpider connection successful. Result: {result.scalar()}\")\n\nexcept Exception as e:\n    print(f\"Error connecting to PGSpider: {e}\")","lang":"python","description":"This quickstart demonstrates how to establish a connection to a PGSpider database using `create_engine` with the 'pgspider://' URI and execute a simple query. Ensure you have the `PGSPIDER_CONN_STR` environment variable set or update the placeholder directly."},"warnings":[{"fix":"Install a suitable driver: `pip install psycopg2-binary` or `pip install psycopg`.","message":"A separate PostgreSQL database driver (e.g., `psycopg2-binary` or `psycopg`) must be installed for `sqlalchemy-pgspider` to function correctly, as PGSpider is PostgreSQL-compatible. The dialect registers itself, but the underlying driver handles the actual network communication.","severity":"gotcha","affected_versions":"0.1.0 and later"},{"fix":"Review the official GitHub repository for updates on feature support. For unsupported features, consider using `connection.execute(text(...))` for raw SQL queries.","message":"As a 0.1.0 release, `sqlalchemy-pgspider` is in its early stages. This means that advanced SQLAlchemy features (e.g., specific ORM capabilities, complex schema reflection) or unique PGSpider features might have limited or no direct support, requiring raw SQL.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Double-check all components of your `pgspider://user:password@host:port/database` URI against your PGSpider server's configuration and ensure the server is running and accessible.","message":"The `pgspider://` connection string must be precisely configured to match your PGSpider server's host, port, database name, username, and password. Incorrect parameters are a common source of `OperationalError`.","severity":"gotcha","affected_versions":"0.1.0 and later"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure the package is correctly installed: `pip install sqlalchemy-pgspider`.","cause":"The `sqlalchemy-pgspider` package is not installed or its entry point for registering the dialect with SQLAlchemy is not recognized.","error":"sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:pgspider"},{"fix":"Install a compatible PostgreSQL driver: `pip install psycopg2-binary` (or `pip install psycopg` if you prefer).","cause":"The Python database driver for PostgreSQL (`psycopg2-binary` or `psycopg`), which `sqlalchemy-pgspider` relies on for actual connectivity, is not installed.","error":"ModuleNotFoundError: No module named 'psycopg2'"},{"fix":"Verify your `pgspider://` connection string details (user, password, host, port, dbname) and ensure your PGSpider instance is running and reachable from your application.","cause":"The connection parameters (host, port, username, password, or database) in the `pgspider://` URI are incorrect, or the PGSpider server is not running or accessible at the specified address.","error":"sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at \"localhost\" (...) failed: FATAL: password authentication failed for user \"postgres\""}]}