To best to create a yammer importer pm

I’ve created a yammer 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.

    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?
2 Likes

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

2 Likes

Hi Jay,

Is that importer public available. If Yes where?

Thx a lot in advance

Rgds Johan

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

3 Likes

Thx. So here: https://github.com/discourse/discourse/blob/main/script/import_scripts/yammer.rb

2 Likes

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

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.

4 Likes