Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0E5A8200D27 for ; Wed, 11 Oct 2017 02:18:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0CD4F160BE1; Wed, 11 Oct 2017 00:18:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4FAB3160BE0 for ; Wed, 11 Oct 2017 02:18:10 +0200 (CEST) Received: (qmail 72671 invoked by uid 500); 11 Oct 2017 00:18:09 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 72662 invoked by uid 99); 11 Oct 2017 00:18:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Oct 2017 00:18:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 920A61A5605 for ; Wed, 11 Oct 2017 00:18:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -98.702 X-Spam-Level: X-Spam-Status: No, score=-98.702 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_NUMSUBJECT=0.5, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 9ZiuBoCVBzqI for ; Wed, 11 Oct 2017 00:18:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 2E8976112D for ; Wed, 11 Oct 2017 00:18:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id AFC4BE2571 for ; Wed, 11 Oct 2017 00:18:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0268A253E9 for ; Wed, 11 Oct 2017 00:18:01 +0000 (UTC) Date: Wed, 11 Oct 2017 00:18:01 +0000 (UTC) From: "Joy Gao (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AIRFLOW-1613) Make MySqlToGoogleCloudStorageOperator compaitible with python3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 11 Oct 2017 00:18:11 -0000 [ https://issues.apache.org/jira/browse/AIRFLOW-1613?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joy Gao updated AIRFLOW-1613: ----------------------------- Description: 1. In Python 3, map(...) returns an iterator, which can only be iterated over once. Therefore the current implementation will return an empty list after the first iteration of schema: {code} schema = map(lambda schema_tuple: schema_tuple[0], cursor.description) file_no = 0 tmp_file_handle = NamedTemporaryFile(delete=True) tmp_file_handles = {self.filename.format(file_no): tmp_file_handle} for row in cursor: # Convert datetime objects to utc seconds, and decimals to floats row = map(self.convert_types, row) row_dict = dict(zip(schema, row)) {code} 2. File opened as binary, but string are written to it. Get error `a bytes-like object is required, not 'str'`. Use mode='w' instead. 3. Update: Currently All was: 1. In Python 3, map(...) returns an iterator, which can only be iterated over once. Therefore the current implementation will return an empty list after the first iteration of schema: {code} schema = map(lambda schema_tuple: schema_tuple[0], cursor.description) file_no = 0 tmp_file_handle = NamedTemporaryFile(delete=True) tmp_file_handles = {self.filename.format(file_no): tmp_file_handle} for row in cursor: # Convert datetime objects to utc seconds, and decimals to floats row = map(self.convert_types, row) row_dict = dict(zip(schema, row)) {code} 2. File opened as binary, but string are written to it. Get error `a bytes-like object is required, not 'str'`. Use mode='w' instead. > Make MySqlToGoogleCloudStorageOperator compaitible with python3 > --------------------------------------------------------------- > > Key: AIRFLOW-1613 > URL: https://issues.apache.org/jira/browse/AIRFLOW-1613 > Project: Apache Airflow > Issue Type: Bug > Components: contrib > Reporter: Joy Gao > Assignee: Joy Gao > Fix For: 1.9.0 > > > 1. > In Python 3, map(...) returns an iterator, which can only be iterated over once. > Therefore the current implementation will return an empty list after the first iteration of schema: > {code} > schema = map(lambda schema_tuple: schema_tuple[0], cursor.description) > file_no = 0 > tmp_file_handle = NamedTemporaryFile(delete=True) > tmp_file_handles = {self.filename.format(file_no): tmp_file_handle} > for row in cursor: > # Convert datetime objects to utc seconds, and decimals to floats > row = map(self.convert_types, row) > row_dict = dict(zip(schema, row)) > {code} > 2. > File opened as binary, but string are written to it. Get error `a bytes-like object is required, not 'str'`. Use mode='w' instead. > 3. Update: > Currently All -- This message was sent by Atlassian JIRA (v6.4.14#64029)