Of course, even if embedding doesn’t quite work, you can always perform your join in application code, by making multiple queries.It turns out that a flexible schema can be very beneficial, especially when you expect to be iterating quickly.Handling schema updates in the relational world is of course doable, but comes with a price.However, this approach does come with its own tradeoffs.For example, type enforcement must be carefully handled by the application code.Custom document versioning might be desirable to avoid large conditional blocks to handle heterogeneous documents in the same collection.Due to an issue with the virtualenv tool mentioned in the next section, pydoc does not work inside a virtual environment.This will permit you to iterate quickly and try new things without fear of destroying a production database.For local development, as long as you have the latest major release, you are probably fine.Finally, you can always build your own binaries from the source code.This is the easiest method, assuming you are on one of these platforms.Mac Ports compiles from source, and so can take considerably longer to install software compared with simply grabbing the binaries.Futhermore, you will need to have Apple’s Xcode Developer Tools installed, along with the X11 windowing environment.In Python, the best practice is to create what is known as a virtual environment in which to install your packages.This isolates them cleanly from any system packages you have installed and yields the added bonus of not requiring root privileges to install additional Python packages.The tool to create a virtual environment is called virtualenv.In case you are unable or simply don’t want to use your system’s package manager, you can always install it yourself, by hand.In order to manually install it, you must have the Python setuptools package.You may already have setuptools on your system.If nothing is printed and you are simply returned to the prompt, you don’t need to do anything.If an ImportError is raised, you need to install setuptools.Once you have setuptools installed on your system, run easy_install virtualenv as root.Now that you have the virtualenv tool available on your machine, you can create your first virtual Python environment.This will create a virtual environment in the directory myenv.You are now ready to install the PyMongo driver.
Sponsored
This is different from a relational database in two significant ways.
Posted 2023-01-27 17:11:52
0
1106
Sponsored