1

The data dictionary should be generated from a CSV file of sample data.

3
  • You want to get the data types from a json file in the title, but you are talking about CSV in the post? Which one is the case?
    – Pred
    Commented Nov 25, 2014 at 12:38
  • Sorry for the confusing question. What I have is a .CSV sample data but when I save it in Mongodb it will be in JSON format.
    – Hillina
    Commented Nov 25, 2014 at 12:41
  • Edit your question with more details as what you have done so far and what exactly you are looing for.
    – vijayp
    Commented Nov 25, 2014 at 13:30

1 Answer 1

1

You can not get all the types from a csv or json file.

Lets check the following example:

asd;3534;0674;slfo

What are the types? The third column with the value 0674 contains a string or an integer, decimal, float or what? Has that leading 0 any meaning? If so, it should be a string/character data.

The case is similar with the JSON files: Dates are stored as strings in those files (for example), you can not determine what its type. There should be values in a sample data which seems to be valid dates, but what is those values are some kind of category identifiers or generated identifiers (2014-01-24 could be for example 'marketing campaign' (id = 01) in the year 2014 for the partner with id of 24).

Conclusion: you can get a prediction from sample data, but you have to determine the real type manually (or at least revise the predictions). You have to 'add' the business meaning to the determination process -> you have to know what does that data mean to determine the data type required to store that data.

Also please note, that the RFC of the CSV files is not determines the "string identifier" character. It could or could not wrap the string with '"' or any other characters.

8
  • Thank you Pred. What I needed is to validate user inputs to MongoDB database and designing a data dictionary seams to be the best option. Is there any other way to achieve this task?
    – Hillina
    Commented Nov 25, 2014 at 18:20
  • What kind of validation do you want to do on what kind of user input for what purposes? (Users mostly don't create csv files manually by typing)
    – Pred
    Commented Nov 25, 2014 at 20:32
  • I was working on Mongodb. I uploaded 500 records which was in .csv format to the database. And I do not want others to upload or enter a different type of record or file format to the specific collection. It is a school project which I am planing to add up to it for my final thesis work.
    – Hillina
    Commented Nov 26, 2014 at 5:08
  • It was my divisor's idea to design and develop a data dictionary. Any possibility to develop a method of validating user input will do fine.
    – Hillina
    Commented Nov 26, 2014 at 7:50
  • 1
    OK, so if mongodb is only for storing / for BI purposes, you simply do not want to walidate the input. If the database is a production database used by an application, the application's role to validate the input. In relational databases you have simple tools to force some rules, but the main place where validation occurs is the application.
    – Pred
    Commented Nov 26, 2014 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.