Question

In my app, when I create a User object, the id is integer. (id=23001)

- kind: User
  connector: csv
  connector_options:
    # TODO: Add connector options here--these are specific to each connector.
  property_map:
    - property: __key__
      external_name: key
      export_transform: transform.key_id_or_name_as_string

I have auto generated the bulkloader above, and when I delete the User and reupload it through the bulkloader, the id is no longer an integer. It is now name=23001

In order to enforce this, I came up with this idea:

- kind: User
  connector: csv
  connector_options:
    # TODO: Add connector options here--these are specific to each connector.
  property_map:
    - property: __key__
      external_name: key
      export_transform: transform.key_id_or_name_as_string
      import_transform: transform.none_if_empty(int)

Now the import is set as integer and indeed I get a id=23001 again.

The actual problem is the other class that uses a foreignkey on User:

- kind: AuthProvider
  connector: csv
  connector_options:
    # TODO: Add connector options here--these are specific to each connector.
  property_map:
    - property: __key__
      external_name: key
      export_transform: transform.key_id_or_name_as_string

    - property: user_key
      external_name: user_key
      # Type: Key Stats: 1 properties of this type in this kind.
      import_transform: transform.create_foreign_key('User')
      export_transform: transform.key_id_or_name_as_string

The field user_key is generated as string again instead of integer. (name=23001) which means the keys are no longer the same, which is very bad.

What can I do, to make user_key to become id=xxx instead of name=xxx ?

many thanks

Was it helpful?

Solution

Please try import_transform: transform.create_foreign_key('User', key_is_id=True)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top