sql inserting profiles

blindmime
@blindmime
7 years ago
772 posts
I have some data I would like to import into my jamroom as profiles. I've been able to get it working and functional for the most part, but a couple things.

When editing/updating the new profile by, say, adding a profile photo and nothing else, I get an error that the profile_url (which was previously imported) is already in use. I also have a Select dropdown which is not displaying the current value I've imported.
updated by @blindmime: 10/11/17 06:11:23PM
paul
@paul
7 years ago
4,326 posts
So you've imported data directly into the profile datastore? If so, and you didn't do it using Jamroom functions you have likely by-passed all the error and data integrity checking that those functions do, so you could well have duplicate 'profile_url's and situations where ther wrong values are returned. How exactly did you try importing? Maybe checkout the Exporter/Importer modules that have a plugin for 'raw' data.


--
Paul Asher - JR Developer and System Import Specialist
blindmime
@blindmime
7 years ago
772 posts
There aren't duplicates. I can change the value, update, then change it back to the original value.

But I understand it's not an optimal method. Or even wise. Haha. You ask how I'm importing. I've just constructed a series of sql inserts to match what I see in the database. I've done this before with thousands of records. Maybe jr5 allowed more crazy.

I looked at the importer when you first announced it, but recall you saying csv importing wasn't an option. When I click the documentation button in my jamroom install it tells me nothing is found, but I did find some by doing a search. It says something about further details about structure to be found in an appendix which is awaiting content.

Anyway, I've proceeded onward but I've not been able to get anything to export so I can see the structure of the json file I would need tp create in order import profile data. I'm guessing I could parse my data into that structure like I constructed the sql insert statements.

I'm guessing I create the json files and put them here? modules/jrExporter/plugins/CSV/samples
paul
@paul
7 years ago
4,326 posts
Without seeing your sql inserts its difficult to suggest what might be going wrong. If I was doing something like this I'd build a small module instead of direct sql queries. The module would read the data from a CSV/JSON/Whatever file, format it the add it to the datastore using the correct Jamroom functions, handling any duplicate error etc. as it goes. That way there's a very good chance all will be well at the end.

Just looked at the Exporter/Importer docs. Yes, the appendix is missing. At the time I guess I figured I'd finish it later, then forgot about it !! I'll do it today and let you know.


--
Paul Asher - JR Developer and System Import Specialist
paul
@paul
7 years ago
4,326 posts
Actually, the information that I was going to put into the appendix is already in the documentation at https://www.jamroom.net/the-jamroom-network/documentation/importing-merging-sites-to-jamroom/4755/json-file-format
Its the 'Intermediary JSON File Format'.
What is suggest you do is with the Exporter module, select the 'Export pre-formatted CSV file contents to JSON' plugin then create suitable CSV files to export. Take a look at the /modules/jrExporter/plugins/CSV/samples/sample_members.csv file for the required format. Then use that in conjunction with the above document to create your own CSV file.


--
Paul Asher - JR Developer and System Import Specialist
blindmime
@blindmime
7 years ago
772 posts
Thanks, Paul. When I click the export pre-formatted CSV file contents to JSON I see no file options to select. Where do the pre-formatted CSV go so they are seen?

I see in the docs that I can add a profile image with the import. Is the file url an external url or does it need to be in a specific place within the jamroom directory?
paul
@paul
7 years ago
4,326 posts
After selecting the CSV Plugin, you can configure the path to the CSV files under the 'Plugin Config' tab.
In the CSV file you create any images imported are via the link specified, so can reside anywhere tht they can be read from.
hth


--
Paul Asher - JR Developer and System Import Specialist
blindmime
@blindmime
7 years ago
772 posts
What if I want to have all imported profiles to be assigned to the admin user?
paul
@paul
7 years ago
4,326 posts
Just set the user_name and user_email to that of the admin in the new member CSV entry and it'll work out.
hth


--
Paul Asher - JR Developer and System Import Specialist
blindmime
@blindmime
7 years ago
772 posts
I'm getting the following error: Error: Invalid filename - 'export.csv'

It's OK to add any other custom fields I might have as well, right?
blindmime
@blindmime
7 years ago
772 posts
Anything?
paul
@paul
7 years ago
4,326 posts
Sorry - This post passed me by.
Can you send me a copy of your csv file attached to a support ticket? I'll then try it on my test site and see what's wrong.
And yes, its ok to add other custom fields, as described in the module docs.


--
Paul Asher - JR Developer and System Import Specialist
blindmime
@blindmime
7 years ago
772 posts
OK

Tags