{"id":24611,"library":"soda-core-postgres","title":"Soda Core PostgreSQL","description":"Extends Soda Core to connect to PostgreSQL databases for data quality monitoring and testing. Current version 3.5.6, released on 2025-11-05. Release cadence is irregular, tied to soda-core releases.","status":"active","version":"3.5.6","language":"python","source_language":"en","source_url":"https://github.com/sodadata/soda-core","tags":["data-quality","testing","postgresql","soda"],"install":[{"cmd":"pip install soda-core-postgres","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core library required; soda-core-postgres is an extension.","package":"soda-core","optional":false},{"reason":"PostgreSQL driver; may need to pin version for compatibility.","package":"psycopg2-binary","optional":true}],"imports":[{"note":"Soda object used to configure scans.","wrong":"","symbol":"Scan","correct":"from soda.scan import Scan"}],"quickstart":{"code":"from soda.scan import Scan\n\nscan = Scan()\nscan.set_scan_definition_name('test')\nscan.set_data_source_name('postgres')\nscan.add_configuration_yaml_str('''\ndata_source postgres:\n  type: postgres\n  host: localhost\n  port: 5432\n  username: ${POSTGRES_USER}\n  password: ${POSTGRES_PASSWORD}\n  database: postgres\n''')\nscan.add_sodacl_yaml_str('''\nchecks for dim_customer:\n  - row_count > 0\n''')\nexit_code = scan.execute()\nprint(scan.get_logs_text())","lang":"python","description":"Runs a Soda scan against a PostgreSQL table using environment variables for credentials."},"warnings":[{"fix":"Use 'type: postgres' in the YAML configuration.","message":"The configuration file must use 'type: postgres' exactly. Using 'postgresql' or other variants will fail silently.","severity":"gotcha","affected_versions":"all"},{"fix":"Run 'pip install psycopg2-binary' or 'pip install asyncpg' in the same environment.","message":"Soda Core requires the PostgreSQL driver (psycopg2 or asyncpg) to be installed separately. soda-core-postgres does not install it automatically.","severity":"gotcha","affected_versions":"all"},{"fix":"Write 'data_source postgres:' exactly as lower_snake_case.","message":"The 'data_source' key in YAML must be lowercase; using 'data_source: Postgres' (capitalized) will be ignored.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure all required environment variables (e.g., POSTGRES_PASSWORD) are set before calling scan.execute().","cause":"Password or other variable is None because environment variable is not set.","error":"soda.core.exceptions.DataSourceConnectionError: Unable to connect to PostgreSQL: could not adapt type 'NoneType'"},{"fix":"Ensure both the YAML key (after 'data_source') and the argument to set_data_source_name() are identical and lowercase.","cause":"The data source name in the configuration does not match the name used in set_data_source_name().","error":"soda.scan.SodaScanError: The given data source name 'postgres' is not configured. Available data sources: []"},{"fix":"Install psycopg2-binary: pip install psycopg2-binary","cause":"The PostgreSQL driver is not installed.","error":"ModuleNotFoundError: No module named 'psycopg2'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}