{"id":18304024,"url":"https://github.com/googleclouddataproc/dataproc-spark-connect-python","last_synced_at":"2025-04-12T15:07:40.885Z","repository":{"id":257665135,"uuid":"857101889","full_name":"GoogleCloudDataproc/dataproc-spark-connect-python","owner":"GoogleCloudDataproc","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-11T01:14:39.000Z","size":182,"stargazers_count":1,"open_issues_count":2,"forks_count":3,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-12T15:07:17.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleCloudDataproc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-13T20:04:28.000Z","updated_at":"2025-04-11T01:14:31.000Z","dependencies_parsed_at":"2024-12-05T21:18:11.029Z","dependency_job_id":"0f6a1459-6e0c-48ad-bb30-124850c4e685","html_url":"https://github.com/GoogleCloudDataproc/dataproc-spark-connect-python","commit_stats":null,"previous_names":["googleclouddataproc/dataproc-spark-connect-python"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudDataproc%2Fdataproc-spark-connect-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudDataproc%2Fdataproc-spark-connect-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudDataproc%2Fdataproc-spark-connect-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudDataproc%2Fdataproc-spark-connect-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleCloudDataproc","download_url":"https://codeload.github.com/GoogleCloudDataproc/dataproc-spark-connect-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586236,"owners_count":21128997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T15:27:34.781Z","updated_at":"2025-04-12T15:07:40.879Z","avatar_url":"https://github.com/GoogleCloudDataproc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Spark Connect Client\n\nA wrapper of the Apache [Spark Connect](https://spark.apache.org/spark-connect/) client with\nadditional functionalities that allow applications to communicate with a remote Dataproc\nSpark cluster using the Spark Connect protocol without requiring additional steps.\n\n## Install\n\n.. code-block:: console\n\n      pip install google_spark_connect\n\n## Uninstall\n\n.. code-block:: console\n\n      pip uninstall google_spark_connect\n\n\n## Setup\nThis client requires permissions to manage [Dataproc sessions and session templates](https://cloud.google.com/dataproc-serverless/docs/concepts/iam).\nIf you are running the client outside of Google Cloud, you must set following environment variables:\n\n* GOOGLE_CLOUD_PROJECT - The Google Cloud project you use to run Spark workloads\n* GOOGLE_CLOUD_REGION - The Compute Engine [region](https://cloud.google.com/compute/docs/regions-zones#available) where you run the Spark workload.\n* GOOGLE_APPLICATION_CREDENTIALS - Your [Application Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc)\n* DATAPROC_SPARK_CONNECT_SESSION_DEFAULT_CONFIG (Optional) - The config location, such as `tests/integration/resources/session.textproto`\n\n## Usage\n\n1. Install the latest version of Dataproc Python client and Google Spark Connect modules:\n\n      .. code-block:: console\n\n            pip install google_cloud_dataproc --force-reinstall\n            pip install google_spark_connect --force-reinstall\n\n2. Add the required import into your PySpark application or notebook:\n\n      .. code-block:: python\n\n            from google.cloud.spark_connect import GoogleSparkSession\n\n3. There are two ways to create a spark session,\n\n   1. Start a Spark session using properties defined in `DATAPROC_SPARK_CONNECT_SESSION_DEFAULT_CONFIG`:\n\n      .. code-block:: python\n\n            spark = GoogleSparkSession.builder.getOrCreate()\n\n   2. Start a Spark session with the following code instead of using a config file:\n\n      .. code-block:: python\n\n            from google.cloud.dataproc_v1 import SparkConnectConfig\n            from google.cloud.dataproc_v1 import Session\n            google_session_config = Session()\n            google_session_config.spark_connect_session = SparkConnectConfig()\n            google_session_config.environment_config.execution_config.subnetwork_uri = \"\u003csubnet\u003e\"\n            google_session_config.runtime_config.version = '3.0'\n            spark = GoogleSparkSession.builder.googleSessionConfig(google_session_config).getOrCreate()\n\n## Billing\nAs this client runs the spark workload on Dataproc, your project will be billed as per [Dataproc Serverless Pricing](https://cloud.google.com/dataproc-serverless/pricing).\nThis will happen even if you are running the client from a non-GCE instance.\n\n## Contributing\n### Building and Deploying SDK\n\n1. Install the requirements in virtual environment.\n\n      .. code-block:: console\n\n            pip install -r requirements.txt\n\n2. Build the code.\n\n      .. code-block:: console\n\n            python setup.py sdist bdist_wheel\n\n\n3. Copy the generated `.whl` file to Cloud Storage. Use the version specified in the `setup.py` file.\n\n      .. code-block:: console\n\n            VERSION=\u003cversion\u003e gsutil cp dist/google_spark_connect-${VERSION}-py2.py3-none-any.whl gs://\u003cyour_bucket_name\u003e\n\n4. Download the new SDK on Vertex, then uninstall the old version and install the new one.\n\n      .. code-block:: console\n\n            %%bash\n            export VERSION=\u003cversion\u003e\n            gsutil cp gs://\u003cyour_bucket_name\u003e/google_spark_connect-${VERSION}-py2.py3-none-any.whl .\n            yes | pip uninstall google_spark_connect\n            pip install google_spark_connect-${VERSION}-py2.py3-none-any.whl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleclouddataproc%2Fdataproc-spark-connect-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogleclouddataproc%2Fdataproc-spark-connect-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleclouddataproc%2Fdataproc-spark-connect-python/lists"}