2

Some weeks ago I posted a question on how to import HTML data in to SQLite. https://stackoverflow.com/q/60645811/6702758

The original question:

Import multiple html files as separate entries into SQLite

I have a lot of html files that i would like to import into a sqlite database.

  • The files are in separate sub-directories.
  • The directories are named by title.
  • The html-files are all named index.html.

Like rootdir/title_name/index.html

I would like to have three columns, 'id', 'title' and html. Where 'title' is the name of the parent directory of the html-file.

Is there a neat way to import it all in one script or query without first needing to rename files or directories?

Almost instantaneously (within 3-4 minutes) my question was downvoted, then closed, and finally deleted. Since the downvote was very quick I suspect there are some very obvious faults.

Unfortunately I can't tell what those faults may be. Is it the way I presented the question, the scope, lack of data details or history, or something else?

It would be helpful if you could point out to me how to improve my questions.

9
  • i thought that is a giood beginning to read stackoverflow.com/help/how-to-ask and as nobody can see what you wrote, it is hard to tell, but when it is that quick to downvote, your questions was tpo broad or nodbpody could reprocude your problem without code. you also didn't mention the closed ground
    – nbk
    Apr 27, 2020 at 9:51
  • I updated the post to include the original question. What do you mean with "closed ground"?
    – Tapper
    Apr 27, 2020 at 9:57
  • 11
    This one in particular was not closed, it was deleted automatically (questions with a negative score which have not received any answers after a month are candidates for automatic removal). What most would wonder about this particular question is what you had tried before asking. It shows no research effort, which is a red flag. See: meta.stackoverflow.com/questions/261592/…
    – E_net4
    Apr 27, 2020 at 10:00
  • 1
    it is too broad and ask for an opinion, that is usually a good cause to close it. when you check the link, you see it is better to have anidea which didn't work out, and you ask for advice.
    – nbk
    Apr 27, 2020 at 10:01
  • 4
    What kind of "script" do you imagine running? An SQL query would seem far-fetched. Are you thinking on any kind of programming language? Have you made any attempt at solving this, or are you just starting to think about the problem? Why renaming files or directories is in any way relevant?
    – yivi
    Apr 27, 2020 at 10:05
  • 1
    As a minor remark, such use of bold is not justified.
    – desertnaut
    Apr 27, 2020 at 10:18
  • 3
    It sort of looks more like a jira ticket than a specific programming problem. What sort of answer can be expected? "Yes(No), there is (not) a neat way." Or do you want someone to provide you with the neat way? For the latter it seems that the answer depends on your setup, so it's not entirely answerable. Unless SQLite has some sort of neat import facility already, and you're just confused about how to use it. But then why didn't you mention it?
    – Scratte
    Apr 27, 2020 at 10:19
  • @yivi , nbk Thanks for the feedback! In this case I had tried to get html data from files to entries in sqlite. I had been doing several clumsy steps of renaming and converting the files to other formats, some bash some python, ending up in a csv that I then imported. Since I am new to general data-management with sqlite I was positive there must be some obvious way just to get the contents of a file into sqlite with little to no ‘custom-solution’ My idea was to avoid clutter writing the question, since I was hoping for ‘the best way to do it’ rather then to debug my python/bash.
    – Tapper
    Apr 27, 2020 at 10:25
  • 8
    This problem can be broken down into these sub problems: 1) iterate through directories of files, 2) extract title from file path, 3) read file contents, 4) put it all together into an SQL query. None of these are especially hard in and of themselves, but the details all depend on your preferred language and/or perhaps restrictions. We're happy to help you answer any concrete problems you may encounter in any of those individual steps, but just throwing it all out there as is is too vague and broad.
    – deceze Mod
    Apr 27, 2020 at 10:53

1 Answer 1

17

It's a set of requirements.

You're not asking a specific question; you're asking, "Given the files are structured in X, and given that I want Y, how would I accomplish this using SQLite without having to do Z?"

Questions on Stack Overflow have a better chance of survival if they don't read like a set of requirements, or at least show that you've put some effort into solving it but are stuck somewhere. It's no ironclad guarantee, as our attention span is increasingly divided, but at a minimum you won't get completely ignored if you show something.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .