How Do I store downloaded pdf files to Mongo DB - python

I download the some of pdf and stored in directory. Need to insert them into mongo database with python code so how could i do these. Need to store them by making three columns (pdf_name, pdf_ganerateDate, FlagOfWork)like that.

You can use GridFS. Please check this URL.
It will help you to store any file to mongoDb and get them. In other collection you can save file metadata.

Related

Create automatic table columns SQL code after a .CSV file in PostgreSQL

I have some large (+500 Mbytes) .CSV files that I need to import into a Postgres SQL database.
I am looking for a script or tool that helps me to:
Generate the table columns SQL CREATE code, ideally taking into account the data in the .CSV file in order to create the optimal data types for each column.
Use the header of the .CSV as the name of the column.
It would be perfect if such functionality existed in PostgreSQL or could be added as an add-on.
Thank you very much
you can use this open source tool called pgfutter to create table from your csv file.
git hub link
also postgresql has COPY functionality however copy expect that the table already exists.

Export mongodb data to json

After running the mongodb docker image I created a database called MovieFlix and some collections with items inside the database.
What I want is to find a way to store all the data from the MovieFlix db in a json file to have it saved for later user for docker-compose.
Should I do it with python code using pymongo or is there a simpler way ?
Mongodb has a command line tool for exporting to json or csv. The keyword for this is dump. Hope it helps!

Do mysql querys in python with zip file

Im trying to do some querys on my data base, but the file is to large and is spending to much time, exists some way to upload one zip file with those querys to my table?
ps: the file have between 350Mb to 500Mb
Store the zip file somewhere else on your server and simply store the name or the file location string in your dB.
Mysql really isn't intended to store large files or better yet zip folders.
Then when you go to retrieve it just unload the file location into an <a> tag it will link to it.

How to store and download a zip file in database postgres

I'm trying to store and then download a zip file from Postgres database. I know that this is not the best approach (i should only save the path to file) but i need to do this way, just for learning and practice.
I did a python script to store the content of the file into a bytea field but this was not my final goal. I really want to know how to save the zip file.
Any ideas? I just know python so i'm trying to this in python
Thank you guys!
If you can store the file as a bytea field then storing a zipped file is just the same.
Postgres doesn't have a concept of "file" field - you simply store the content (as you did for the original content) in bytea field.
If you're asking about zipping a file on the fly,
Take a look at zlib it's one of the common modules for such tasks.
Regards
Jony

OpenERP 6.1 module with upload file field

I want to create OpenERP 6.1 module with a upload binary file field as one of the fields in view.
The file will be stored in database as binary data, but before storage in database I need to parse that file, and save data as part of the other created module.
So, I don't know how to specifiy filed for upload files in a view xml file, and also how to run the uploading process. Can somebody help me about this? Some code snippets or advice how to do that.
Take a look at the way the attachments module works, particularly the binary data column. You should also look at the screen definition.

Categories