# Unable to connect to redshift from dbt: Database Error ('communication error', OSError('Int or String expected'))

**URL:** https://discourse.getdbt.com/t/unable-to-connect-to-redshift-from-dbt-database-error-communication-error-oserror-int-or-string-expected/9142
**Category:** Show and Tell
**Tags:** redshift
**Created:** [July 14, 2023, 8:58am UTC](https://discourse.getdbt.com/t/unable-to-connect-to-redshift-from-dbt-database-error-communication-error-oserror-int-or-string-expected/9142 "2023-07-14T08:58:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![leoniddatta](https://avatars.discourse-cdn.com/v4/letter/l/a88e57/32.png) [@leoniddatta](https://discourse.getdbt.com/u/leoniddatta)
#### Post date: [July 14, 2023, 8:58am UTC](https://discourse.getdbt.com/t/unable-to-connect-to-redshift-from-dbt-database-error-communication-error-oserror-int-or-string-expected/9142/1 "2023-07-14T08:58:00Z")

</div>

I have a database in aws redshift. I can read the data from my ec2 using credentials (username/ pass etc.) But when I am trying to connect (from same ec2) to redshift using dbt, the dbt debug command shows this error

> 1 check failed: 08:08:12 dbt was unable to connect to the specified database. The database returned the following error:

> Database Error (‘communication error’, OSError(‘Int or String expected’))

Check your database credentials and try again. For more information, visit: [https://docs.getdbt.com/docs/configure-your-profile](https://docs.getdbt.com/docs/configure-your-profile)

I double/ triple checked the credentials, they are correct.

also profile name is correct. my profiles.yml looks like :

```auto
profile_name_xxx:
  target: dev
  outputs:
    dev:
      dbname: dev
      host: aws_host_name
      password: xxx
      port: 1111
      schema: staging
      threads: 1
      type: redshift
      user: awsuser
      region: eu-west-x
      cluster_id: xxxx

```

Can someone help me to fix this issue and connect to my db?

---

<div class="post-metadata">

### Author: ![Winnie](https://avatars.discourse-cdn.com/v4/letter/w/e480ec/32.png) [@Winnie](https://discourse.getdbt.com/u/Winnie)
#### Post date: [July 14, 2023, 2:43pm UTC](https://discourse.getdbt.com/t/unable-to-connect-to-redshift-from-dbt-database-error-communication-error-oserror-int-or-string-expected/9142/2 "2023-07-14T14:43:42Z")

</div>

if you happen to have version 1.5.5 of dbt-redshift at that moment that could be why. You could either do the following:

1. downgrade to version 1.4
2. update dbt-redshift to the latest possible (1.5.8)

Here’s the Github issue created for this

> <https://github.com/dbt-labs/dbt-redshift/issues/518>
>
> \### Is this a regression in a recent version of dbt-redshift?
> 
> \- \[X\] I believe… this is a regression in dbt-redshift functionality
> \- \[X\] I have searched the existing issues, and I could not find an existing issue for this regression
> 
> \### Current Behavior
> 
> \`dbt compile\` fails with a "communication error"/OSError using DBT 1.5.
> 
> !\[image\](https://github.com/dbt-labs/dbt-redshift/assets/92332389/d0901b53-686d-470f-82f8-f30c7a38a016)
> 
> \### Expected/Previous Behavior
> 
> \`dbt compile\` succeeds using DBT 1.4
> 
> !\[image\](https://github.com/dbt-labs/dbt-redshift/assets/92332389/ec1592b2-5a8c-42ad-b34a-5e1f44b4a65b)
> 
> \### Steps To Reproduce
> 
> 1. Install DBT 1.5
> 2. Run \`dbt compile\`
> 
> \### Relevant log output
> 
> \_No response\_
> 
> \### Environment
> 
> \`\`\`markdown
> \- OS: MacOS 13.3.1 (a) and Ubuntu
> \- Python: 3.10.5
> \- dbt-core (working version): 1.4.6
> \- dbt-redshift (working version): 1.4.6
> \- dbt-core (regression version): 1.5.2.
> \- dbt-redshift (regression version): 1.5.0
> \`\`\`
> 
> \<details\>
> \<summary\>pip packages (working)\</summary\>
> 
> \`\`\`
> Package Version
> \------------------------ --------
> agate 1.7.0
> annotated-types 0.5.0
> appdirs 1.4.4
> asn1crypto 1.5.1
> attrs 23.1.0
> Babel 2.12.1
> beautifulsoup4 4.12.2
> betterproto 1.2.5
> black 23.3.0
> boto3 1.26.165
> botocore 1.29.165
> certifi 2023.5.7
> cffi 1.15.1
> chardet 5.1.0
> charset-normalizer 3.1.0
> click 8.1.3
> click-config-file 0.6.0
> colorama 0.4.6
> configobj 5.0.8
> dataclasses-json 0.5.4
> dbt-core 1.4.6
> dbt-extractor 0.4.1
> dbt-postgres 1.4.6
> dbt-redshift 1.4.0
> decorator 5.1.1
> diff-cover 7.6.0
> exceptiongroup 1.1.2
> future 0.18.3
> graphql-core 3.2.3
> grpclib 0.4.5
> gunicorn 20.1.0
> h2 4.1.0
> hologram 0.0.16
> hpack 4.0.0
> hyperframe 6.0.1
> idna 3.4
> iniconfig 2.0.0
> isodate 0.6.1
> Jinja2 3.1.2
> jinja2-simple-tags 0.5.0
> jmespath 1.0.1
> jsonschema 4.17.3
> leather 0.3.4
> Logbook 1.5.3
> lxml 4.9.3
> markdown-it-py 3.0.0
> MarkupSafe 2.0.1
> marshmallow 3.19.0
> marshmallow-enum 1.5.1
> mashumaro 3.3.1
> mdurl 0.1.2
> minimal-snowplow-tracker 0.0.2
> montecarlodata 0.40.2
> msgpack 1.0.5
> multidict 6.0.4
> mypy-extensions 1.0.0
> networkx 2.8.8
> packaging 23.1
> parsedatetime 2.4
> pathspec 0.10.3
> pip 22.0.4
> platformdirs 3.8.0
> pluggy 1.2.0
> protobuf 4.23.3
> psycopg2-binary 2.9.6
> py 1.11.0
> pycarlo 0.7.1
> pycparser 2.21
> pydantic 2.0.2
> pydantic\_core 2.1.2
> Pygments 2.15.1
> pyrsistent 0.19.3
> pytest 7.4.0
> python-box 7.0.1
> python-dateutil 2.8.2
> python-slugify 8.0.1
> pytimeparse 1.1.8
> pytz 2023.3
> PyYAML 6.0
> redshift-connector 2.0.912
> regex 2023.6.3
> requests 2.31.0
> retry 0.9.2
> rich 13.4.2
> ruamel.yaml 0.17.32
> ruamel.yaml.clib 0.2.7
> s3transfer 0.6.1
> scramp 1.4.4
> setuptools 58.1.0
> sgqlc 14.1
> shandy-sqlfmt 0.19.0
> six 1.16.0
> soupsieve 2.4.1
> sqlfluff 2.1.2
> sqlfluff-templater-dbt 2.1.2
> sqlparse 0.4.3
> stringcase 1.2.0
> tabulate 0.9.0
> tblib 2.0.0
> text-unidecode 1.3
> toml 0.10.2
> tomli 2.0.1
> tqdm 4.65.0
> typing\_extensions 4.7.1
> typing-inspect 0.9.0
> urllib3 1.26.16
> Werkzeug 2.1.2
> \`\`\`
> 
> \</details\>
> 
> 
> \<details\>
> 
> \<summary\>pip packages (regression)\</summary\>
> 
> \`\`\`
> Package Version
> \------------------------ --------
> agate 1.7.0
> annotated-types 0.5.0
> appdirs 1.4.4
> asn1crypto 1.5.1
> attrs 23.1.0
> Babel 2.12.1
> beautifulsoup4 4.12.2
> betterproto 1.2.5
> black 23.3.0
> boto3 1.26.165
> botocore 1.29.165
> certifi 2023.5.7
> cffi 1.15.1
> chardet 5.1.0
> charset-normalizer 3.1.0
> click 8.1.3
> click-config-file 0.6.0
> colorama 0.4.6
> configobj 5.0.8
> dataclasses-json 0.5.4
> dbt-core 1.5.2
> dbt-extractor 0.4.1
> dbt-postgres 1.5.2
> dbt-redshift 1.5.0
> decorator 5.1.1
> diff-cover 7.6.0
> exceptiongroup 1.1.2
> future 0.18.3
> graphql-core 3.2.3
> grpclib 0.4.5
> gunicorn 20.1.0
> h2 4.1.0
> hologram 0.0.16
> hpack 4.0.0
> hyperframe 6.0.1
> idna 3.4
> iniconfig 2.0.0
> isodate 0.6.1
> Jinja2 3.1.2
> jinja2-simple-tags 0.5.0
> jmespath 1.0.1
> jsonschema 4.17.3
> leather 0.3.4
> Logbook 1.5.3
> lxml 4.9.3
> markdown-it-py 3.0.0
> MarkupSafe 2.0.1
> marshmallow 3.19.0
> marshmallow-enum 1.5.1
> mashumaro 3.6
> mdurl 0.1.2
> minimal-snowplow-tracker 0.0.2
> montecarlodata 0.40.2
> msgpack 1.0.5
> multidict 6.0.4
> mypy-extensions 1.0.0
> networkx 2.8.8
> packaging 23.1
> parsedatetime 2.4
> pathspec 0.10.3
> pip 22.0.4
> platformdirs 3.8.0
> pluggy 1.2.0
> protobuf 4.23.3
> psycopg2-binary 2.9.6
> py 1.11.0
> pycarlo 0.7.1
> pycparser 2.21
> pydantic 2.0.2
> pydantic\_core 2.1.2
> Pygments 2.15.1
> pyrsistent 0.19.3
> pytest 7.4.0
> python-box 7.0.1
> python-dateutil 2.8.2
> python-slugify 8.0.1
> pytimeparse 1.1.8
> pytz 2023.3
> PyYAML 6.0
> redshift-connector 2.0.912
> regex 2023.6.3
> requests 2.31.0
> retry 0.9.2
> rich 13.4.2
> ruamel.yaml 0.17.32
> ruamel.yaml.clib 0.2.7
> s3transfer 0.6.1
> scramp 1.4.4
> setuptools 58.1.0
> sgqlc 14.1
> shandy-sqlfmt 0.19.0
> six 1.16.0
> soupsieve 2.4.1
> sqlfluff 2.1.2
> sqlfluff-templater-dbt 2.1.2
> sqlparse 0.4.3
> stringcase 1.2.0
> tabulate 0.9.0
> tblib 2.0.0
> text-unidecode 1.3
> toml 0.10.2
> tomli 2.0.1
> tqdm 4.65.0
> typing\_extensions 4.7.1
> typing-inspect 0.9.0
> urllib3 1.26.16
> Werkzeug 2.1.2
> \`\`\`
> 
> \</details\>
> 
> \### Additional Context
> 
> Tested in a venv.
