{"id":15287741,"url":"https://github.com/wittline/livyc","last_synced_at":"2026-06-19T22:30:18.887Z","repository":{"id":37990165,"uuid":"502167088","full_name":"Wittline/livyc","owner":"Wittline","description":"Apache Spark as a Service with Apache Livy Client","archived":false,"fork":false,"pushed_at":"2022-09-19T23:30:25.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-14T18:40:28.881Z","etag":null,"topics":["apache-livy","apache-spark","big-data","data-engineering","dataengineering","docker","livy-client","livy-docker","pyhton","spark"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wittline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-10T20:03:17.000Z","updated_at":"2023-04-23T16:04:48.000Z","dependencies_parsed_at":"2022-09-26T21:12:14.992Z","dependency_job_id":null,"html_url":"https://github.com/Wittline/livyc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wittline%2Flivyc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wittline%2Flivyc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wittline%2Flivyc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wittline%2Flivyc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wittline","download_url":"https://codeload.github.com/Wittline/livyc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219846951,"owners_count":16556418,"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":["apache-livy","apache-spark","big-data","data-engineering","dataengineering","docker","livy-client","livy-docker","pyhton","spark"],"created_at":"2024-09-30T15:36:11.895Z","updated_at":"2026-06-19T22:30:18.855Z","avatar_url":"https://github.com/Wittline.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# livyc\n## Apache Livy Client\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg \n    src=\"https://user-images.githubusercontent.com/8701464/173258806-a1d55121-1d05-4ed3-9c6b-3b31d9b61f82.png\"\n  \u003e\n\u003c/p\u003e\n\n\n## Install library\n```python\npip install livyc\n```\n\n## Import library\n```python\nfrom livyc import livyc\n```\n\n## Setting livy configuration \n```python\ndata_livy = {\n    \"livy_server_url\": \"localhost\",\n    \"port\": \"8998\",\n    \"jars\": [\"org.postgresql:postgresql:42.3.1\"]\n}\n```\n\n## Let's try launch a pySpark script to Apache Livy Server\n\n```python\nparams = {\"host\": \"localhost\", \"port\":\"5432\", \"database\": \"db\", \"table\":\"staging\", \"user\": \"postgres\", \"password\": \"pg12345\"}\n```\n\n```python\npyspark_script = \"\"\"\n\n    from pyspark.sql.functions import udf, col, explode\n    from pyspark.sql.types import StructType, StructField, IntegerType, StringType, ArrayType\n    from pyspark.sql import Row\n    from pyspark.sql import SparkSession\n\n\n    df = spark.read.format(\"jdbc\") \\\n        .option(\"url\", \"jdbc:postgresql://{host}:{port}/{database}\") \\\n        .option(\"driver\", \"org.postgresql.Driver\") \\\n        .option(\"dbtable\", \"{table}\") \\\n        .option(\"user\", \"{user}\") \\\n        .option(\"password\", \"{password}\") \\\n        .load()\n        \n    n_rows = df.count()\n\n    spark.stop()\n\"\"\"\n```\n\n#### Creating an livyc Object\n```python\nlvy = livyc.LivyC(data_livy)\n```\n\n#### Creating a new session to Apache Livy Server\n```python\nsession = lvy.create_session()\n```\n\n#### Send and execute script in the Apache Livy server\n```python\nlvy.run_script(session, pyspark_script.format(**params))\n```\n\n#### Accesing to the variable \"n_rows\" available in the session\n```python\nlvy.read_variable(session, \"n_rows\")\n```\n\n## Contributing and Feedback\nAny ideas or feedback about this repository?. Help me to improve it.\n\n## Authors\n- Created by \u003ca href=\"https://twitter.com/RamsesCoraspe\"\u003e\u003cstrong\u003eRamses Alexander Coraspe Valdez\u003c/strong\u003e\u003c/a\u003e\n- Created on 2022\n\n## License\nThis project is licensed under the terms of the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwittline%2Flivyc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwittline%2Flivyc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwittline%2Flivyc/lists"}