Use the PyODPS SDK to inspect and verify MaxCompute projects with Python. This topic demonstrates two operations:
-
Get project information using
get_project() -
Check whether a project exists using
exist_project()
Prerequisites
Before you begin, ensure that you have:
-
PyODPS installed
-
A MaxCompute entry point (
odpsoro) initialized
If you are running code in a DataWorks PyODPS node, the global variableodpsorois available by default. Skip the initialization step and useodirectly in your code.
Get project information
Call get_project() on a MaxCompute entry point to retrieve metadata about a project. A project is the basic organizational unit in MaxCompute. For more information, see Project.
get_project() accepts an optional project name argument:
| Argument | Behavior |
|---|---|
get_project('project_name') |
Returns information about the specified project |
get_project() |
Returns information about the current project |
# Get information about a specific project
project = o.get_project('project_name')
# Get information about the current project
project = o.get_project()
Check whether a project exists
Call exist_project() to verify that a project exists before performing operations on it.
exists = o.exist_project('project_name')
print(exists)
What's next
-
Explore table management operations using the PyODPS SDK.