# Om de beste yammer-importeur te maken, pm

**URL:** https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849
**Category:** Development
**Created:** [23 mei 2022 om 15:09 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849 "2022-05-23T15:09:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [23 mei 2022 om 15:09 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/1 "2022-05-23T15:09:23Z")

</div>

I’ve created a [yammer](https://www.microsoft.com/en-us/microsoft-365/yammer/yammer-overview) importer for someone and they would like for it to be publicly available. (Hey @gerhard , I think this one is in your wheelhouse.) I can’t quite make sense of yammer’s popularity and/or whether it’s something that will soon have lots of people clammering for a new platform or whether most of those people just expect to lose their data when they leave the platform.

The yammer export is a bunch of CSV files, so the import script uses `script/import_scripts/base/generic_database.rb`. It includes importing PMs, which required adding a couple of tables to the `generic_database.rb`. I thought that it made more sense to add separate code for PMs than to try to coerce the existing code to handle them and risk breaking it for the other importers that use it (zendesk, zendesk\_api, and answerbase). Also, attachments are handled differently than they must be in the scripts that use `generic_database.rb`, so my PM tables don’t manage uploads the way that the othere do (which I couldn’t quite make sense of). I also added an upload table rather than use `topic_upload` and `post_upload` as the generic importer uses.

```plaintext
    def create_upload_table
      @db.execute <<-SQL
        CREATE TABLE IF NOT EXISTS upload (
          id #{key_data_type} NOT NULL PRIMARY KEY,
          user_id INTEGER,
          original_filename TEXT,
          filename TEXT,
          description TEXT,
          url TEXT
        )
      SQL
    end

```

The current code processes uploads when it sees reference to them in `raw`. It also replaces references to users with discourse `@username` references. It also handles some bizarre `opengraphobject` and uses those, if they exist to generate topic titles (which are missing from most topics in the dump I wrote this for).

#### Questions:

- is this too much handwaiving to be able to answer these questions?
- should I create a PM to core, or just include this as a standalone repo (I will include a script that will copy the code into the discourse source tree and run it from there)
- do the additions to `generic_database` sound reasonable or should I contnrive to add to that class in my import script or just include my additional functions in my own script and have it just refer to the global `@db`?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [23 mei 2022 om 15:13 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/2 "2022-05-23T15:13:13Z")

</div>

I’d say, create a PR for core and we go from there…

---

<div class="post-metadata">

### Author: ![parlevjo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parlevjo/32/336344_2.png) [@parlevjo](https://meta.discourse.org/u/parlevjo)
#### Post date: [29 oktober 2023 om 12:29 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/3 "2023-10-29T12:29:45Z")

</div>

> [@pfaffman](#):
>
> importer for someone and they would like for it to be publicly available

Hi Jay,

Is that importer public available. If Yes where?

Thx a lot in advance

Rgds Johan

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [30 oktober 2023 om 15:40 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/4 "2023-10-30T15:40:14Z")

</div>

There’s a yammer import script in `script/import_scripts/yammer.rb`

---

<div class="post-metadata">

### Author: ![parlevjo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parlevjo/32/336344_2.png) [@parlevjo](https://meta.discourse.org/u/parlevjo)
#### Post date: [30 oktober 2023 om 16:47 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/5 "2023-10-30T16:47:45Z")

</div>

Thx. So here: [discourse/script/import\_scripts/yammer.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/script/import_scripts/yammer.rb)

---

<div class="post-metadata">

### Author: ![parlevjo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/parlevjo/32/336344_2.png) [@parlevjo](https://meta.discourse.org/u/parlevjo)
#### Post date: [30 oktober 2023 om 20:48 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/6 "2023-10-30T20:48:51Z")

</div>

Hi Jay.

I thought this was an importer for Yammer.  
But if I read the code that is not the case.  
It looks like it is an importer for Discourse.  
I am not so familiar with discourse. Can you tell me something about importer for Discourse.

Thx in advance

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [30 oktober 2023 om 21:02 UTC](https://meta.discourse.org/t/to-best-to-create-a-yammer-importer-pm/227849/7 "2023-10-30T21:02:30Z")

</div>

Right. This site is for Discourse, so an “X importer” pretty much always means “an importer to move your old X site to Discourse”.

If you have a Yammer site and want to have a Discourse site, this can help.
