Skip to content

Commit

Permalink
Merge pull request #1951 from fishtown-analytics/fix/change-psycopg-name
Browse files Browse the repository at this point in the history
Use 'psycopg2-binary' package by default on all platforms
  • Loading branch information
beckjake authored Nov 25, 2019
2 parents 9a9f705 + 45a155a commit 5b1e4f5
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions plugins/postgres/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
from setuptools import find_namespace_packages
from setuptools import setup
import os
import sys

PSYCOPG2_MESSAGE = '''
No package name override was set.
Using 'psycopg2-binary' package to satisfy 'psycopg2'
If you experience segmentation faults, silent crashes, or installation errors,
consider retrying with the 'DBT_PSYCOPG2_NAME' environment variable set to
'psycopg2'. It may require a compiler toolchain and development libraries!
'''.strip()


def _dbt_psycopg2_name():
Expand All @@ -11,14 +19,9 @@ def _dbt_psycopg2_name():
if package_name:
return package_name

binary_only_versions = [(3, 8)]

# binary wheels don't exist for all versions. Require psycopg2-binary for
# them and wait for psycopg2.
if sys.version_info[:2] in binary_only_versions:
return 'psycopg2-binary'
else:
return 'psycopg2'
# default to psycopg2-binary for all OSes/versions
print(PSYCOPG2_MESSAGE)
return 'psycopg2-binary'


package_name = "dbt-postgres"
Expand Down

0 comments on commit 5b1e4f5

Please sign in to comment.