My question is how to create a simple database in python. My example is:
User = {
'Name' : {'Firstname', 'Lastname'},
'Address' : {'Street','Zip','State'},
'CreditCard' : {'CCtype','CCnumber'},
}
Now I can update this User's information just fine, but how do I
Thanks for any responses, I've been trying to wrap my head around this for awhile
SQLite. SQLite is probably the most straightforward database to connect to with a Python application since you don't need to install any external Python SQL modules to do so. By default, your Python installation contains a Python SQL library named sqlite3 that you can use to interact with an SQLite database.
The Python programming language has powerful features for database programming. Python supports various databases like SQLite, MySQL, Oracle, Sybase, PostgreSQL, etc. Python also supports Data Definition Language (DDL), Data Manipulation Language (DML) and Data Query Statements.
One of them is SQLite. SQLite is an embedded, file-based relational database management system (RDBMS) that can be used in our Python applications without having to install any additional software. Instead, we only need to import the built-in Python library sqlite3 to use this database.
SQL, which stands for structured query language, is a programming language in which the user queries relational databases. Data scientists use SQL in Python in a variety of instances, dictated by the use case at hand or by personal preference.
You might be interested in SQLAlchemy. It makes an actual database, such as SQLite or MySQL, work more like Python classes.
Most key-value stores I've seen are either a dictionary of dictionaries (like mongo*) or a dictionary of strings (like redis). There are pros and cons to both approaches. I don't know what you want, so I'll give the simplest answer: Go with a list of dictionaries:
Users = []
Users.append({
'Name' : {'Firstname', 'Lastname'}, # Are these sets?
'Address' : {'Street','Zip','State'},
'CreditCard' : {'CCtype','CCnumber'},
})
*OK, to be fair, Mongo is more like a dictionary of magic strings. It's json, but the lookups are handled internally, so you can treat it like a dictionary of arbitrary (but json-serializable) data structures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With