git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variables export


Hi Michael,

Let's assume you use a fernet key and you have two variables defined
through the UI with key -> value

k_string -> this is a string
k_int -> 10

The exporter will produce a compliant JSON:

{
    "k_string": "this is a string",
    "k_int": 10
}

But the importer will fail on k_int because it was exported as a JSON int
and not a JSON string.

Forcing the conversion as suggested in my first email works but is not
really nice:
self._val = fernet.encrypt(bytes(str(value), 'utf-8')).decode()

Let me know if you need anything else, I also created AIRFLOW-2666
<https://issues.apache.org/jira/browse/AIRFLOW-2666> if you want to track
it.

Thx again,
E

On Thu, Jun 28, 2018 at 3:06 PM Michael Crawford <
michael.crawford@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> There variable import/export is broken in general.
>
> Our team has a fix for it.  I will get them to put it over into the
> airflow repo.
>
> Can you provide a specific example where your item is failing and I will
> make sure it gets included.
>
> Thanks,
> Mike
>
>
>
> > On Jun 19, 2018, at 10:57 AM, Emmanuel Brard <
> emmanuel.brard@xxxxxxxxxxxxxxxx> wrote:
> >
> > Hi,
> >
> > When exporting variables, it looks like the export helper serialize to
> JSON
> > with JSON type, so an float is a float in the resulting file.
> >
> > But then when importing from this file, there is no type convertion and
> > this step in the set_val method (class Variable) fails:
> >
> > self._val = fernet.encrypt(bytes(value, 'utf-8')).decode()
> >
> > With "encoding without a string argument"
> >
> > A simple fix would be to:
> >
> > self._val = fernet.encrypt(bytes(str(value), 'utf-8')).decode()
> >
> > Are you aware of this issue ?
> >
> > I am not sure what is the behaviour without encryption, I suppose
> > SQLAlchemy will do the type conversion to persist it as string.
> >
> > Thanks,
> > Emmanuel
> >
> > --
> >
> >
> >
> >
> >
> >
> >
> >
> > GetYourGuide AG
> >
> > Stampfenbachstrasse 48
> >
> > 8006 Zürich
> >
> > Switzerland
> >
> >
> >
> > <https://www.facebook.com/GetYourGuide>
> > <https://twitter.com/GetYourGuide>
> > <https://www.instagram.com/getyourguide/>
> > <https://www.linkedin.com/company/getyourguide-ag>
> > <http://www.getyourguide.com>
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> *CONFIDENTIALITY NOTICE:* This e-mail message may contain material
> protected by the Health Insurance Portability and Accountability Act of
> 1996 and its implementing regulations and other state and federal laws and
> legal privileges. This message is only for the personal and confidential
> use of the individuals or organization to whom the message is addressed.
> If
> you are an unintended recipient, you have received this message in error,
> and any reading, distributing, copying or disclosure is unauthorized and
> strictly prohibited.  All recipients are hereby notified that any
> unauthorized receipt does not waive any confidentiality obligations or
> privileges. If you have received this message in error, please notify the
> sender immediately at the above email address and confirm that you have
> deleted or destroyed the message.
>

-- 








GetYourGuide AG

Stampfenbachstrasse 48  

8006 Zürich

Switzerland



 <https://www.facebook.com/GetYourGuide>  
<https://twitter.com/GetYourGuide>  
<https://www.instagram.com/getyourguide/>  
<https://www.linkedin.com/company/getyourguide-ag>  
<http://www.getyourguide.com>