def json_schema_to_sql_type(self, schema): psql_type = PostgresTarget.json_schema_to_sql_type(self, schema) max_length = schema.get('maxLength', self.default_column_length) if max_length > self.MAX_VARCHAR: max_length = self.MAX_VARCHAR if psql_type.upper() == 'TEXT': return 'varchar({})'.format(max_length) elif psql_type.upper() == 'TEXT NOT NULL': return 'varchar({}) NOT NULL'.format(max_length) return psql_type
def json_schema_to_sql_type(self, schema): psql_type = PostgresTarget.json_schema_to_sql_type(self, schema) assert not 'NOT NULL' in psql_type, 'Redshift does not support `NOT NULL` without a default. Got: {}'.format( psql_type, schema ) max_length = schema.get('maxLength', self.default_column_length) if max_length > self.MAX_VARCHAR: max_length = self.MAX_VARCHAR if psql_type.upper() == 'TEXT': return 'varchar({})'.format(max_length) return psql_type