Python internal database use - python

Say I have a database of recipes that I have online, and I want to use this database in a program, but I want to store the information from the database internally to the program and only have to connect to the online database when I want to update, however I don't want my end-users to have to have a database(MySql, MSSQL, etc..) installed to their machine. What would be the best way to efficiently do this?

sqlite is the most common way to use databases without a database server.

Related

Simple DB to maintain one view?

I have a python program in which I am downloading user data and updating a table. I only need to store the most current updates for each user.
Is there a simple (maybe No SQL, key/value) DB that would be good for maintaining a single table like this? I would just store it in a dict in python but I need persistence.
I am running this on an AWS EC2 linux server. I know there are AWS options (Dynamo) but I thought a local DB might be easier.
Thanks
Look into python stdblib dbm module, fallback to an embedded okvs.

Is there any way to use Oracle instead of MySQL without changing existing code base in Python?

I developed an application in C, using MySQL. Now I wanted to migrate to Oracle, and don't want to make so many changes in code as well, like connecting to database and etc. 'liboramysql' a MySQL Client Library Driver for Oracle Database which is very useful in this case.
But a part of my entire code is written in Python as well, for which I need a similar lib or something similar to it. Is there any way to do this?

MySQL for locally saved database , are there any alternatives

I have been trying to save some data into txt files, but now I have decided to use a database to store these values. But I can't seem to find how can this be achieved, I've read through some tutorials but they all seem to be for online app building.
Are there any modules that can be used to create MySQL database on my hard disk , are there any alternatives ?
Is it necessary to make a server even if i'm using the database on the same computer for some local stuff ?
If you only need a local database, you can use the builtin sqlite3-database.

Graphic User Interfaces for a Database

I'm trying to learn how to create a database for the school storage and a friend told me that it can be done with Python. Is that true ? If not, where can I learn about programming databases besides MySQL ?.
Also how can I create a friendly GUI to help the user with the database?
Your best bet is to find a Python driver/connector for the database of your choice.
A database (or more specifically Relational Database Management System, RDBMS) is a piece of software that is specially designed to handle data. Python, in and of itself, is not sufficient in this regard; you still need a database like MySql.
But you can connect to MySql from python using a connector or driver. The connectors that are available for MySQL are here: http://www.mysql.com/products/connector/
I have personnaly already use SQL database with python. I use sqlalchemy.
https://www.sqlalchemy.org
There is a really good official documentation
https://docs.sqlalchemy.org/en/13/orm/tutorial.html

Small "embeddable" database that can also be synced over the network?

I am looking for a small database that can be "embedded" into my Python application without running a separate server, as one can do with SQLite or Metakit. I don't need an SQL database, in fact storing free-form data like Python dictionaries or JSON is preferable.
The other requirement is that to be able to run an instance of the database on a server, and have instances of my application (clients) sync the database with the server (two-way), similar to what CouchDB replication can do.
Is there a database that will do this?
From what you describe, it sounds like you could get by using pickle and FTP.
If you don't need an SQL database, what's wrong with CouchDB? You can spawn a local process to serve the DB, and you could easily write a server wrapper to allow only access from your app. I'm not sure about the access story, but I believe the latest Ubuntu uses CouchDB for synchronizeable user-level data.
Seems like the perfect job for CouchDB: 2 way sync is incredibly easy, schema-less JSON documents are the native format. If you're using python, couchdb-python is a great way to work with CouchDB.
Do you need clients to work offline and then resync when they reconnect to the network? I don't know if MongoDB can handle the offline client scenario, but if the client is online all the time, MongoDB might be a good solution too. It has pretty goode python support. Still a separate process, but perhaps easier to get running on Windows than CouchDB.
BerkeleyDB might be another option to check out, and it's lightweight enough. easy_install bsddb3 if you need a Python interface.
HSQLDB does this, but unfortunately it's Java rather than Python.
Firebird SQL might be closer to what you want, since it does seem to have a Python interface.

Categories

Resources