Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: whummer/postgresql-proxy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: dfangl/postgresql-proxy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 16, 2022

  1. Copy the full SHA
    59296a8 View commit details
  2. Copy the full SHA
    621bdcc View commit details

Commits on Feb 21, 2022

  1. bump version

    dfangl committed Feb 21, 2022
    Copy the full SHA
    34d1190 View commit details
Showing with 12 additions and 2 deletions.
  1. +10 −1 postgresql_proxy/interceptors.py
  2. +1 −0 requirements.txt
  3. +1 −1 setup.py
11 changes: 10 additions & 1 deletion postgresql_proxy/interceptors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from pg8000.converters import PG_PY_ENCODINGS

class Interceptor:
def __init__(self, interceptor_config, plugins, context):
@@ -12,9 +13,17 @@ def intercept(self, packet_type, data):
def get_codec(self):
if self.context is not None and 'connect_params' in self.context:
if self.context['connect_params'] is not None and 'client_encoding' in self.context['connect_params']:
return self.context['connect_params']['client_encoding']
return self.convert_encoding_to_python(self.context['connect_params']['client_encoding'])
return 'utf-8'

@staticmethod
def convert_encoding_to_python(encoding: str) -> str:
encoding = encoding.lower()
result = PG_PY_ENCODINGS.get(encoding, encoding)
if not result:
raise Exception(f"Encoding {encoding} not supported by postgresql-proxy!")
return result


class CommandInterceptor(Interceptor):
def intercept(self, packet_type, data):
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pg8000>=1.10
psycopg2-binary>=2.7.5
PyYAML>=3.13
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

setup(
name='postgresql-proxy',
version='0.0.3',
version='0.0.4',
description='Postgresql Proxy',
packages=find_packages(exclude=('tests', 'tests.*')),
install_requires=install_requires,