# AGESimpleSQL
AGESimpleSQL is a simple SQL wrapper for Apache AGE using `psycopg2` [connection pooling](https://www.psycopg.org/psycopg3/docs/advanced/pool.html). It supports operations such as creating and dropping graphs, creating vertex and edge labels, creating vertices and edges, retrieving graph and label information, and executing SQL and Cypher queries. It is not the official driver for Apache AGE.
[Apache AGE](https://age.apache.org/) is a PostgreSQL extension that provides graph database functionality. The goal of the Apache AGE project is to create single storage that can handle both relational and graph model data so that users can use standard ANSI SQL along with openCypher, the Graph query language.
## Usage
```python
from age_simple_sql import AGESimpleSQL
from age_simple_sql.models import Vertex
# Initialize the AGESimpleSQL instance
db = AGESimpleSQL(
user="your_db_user",
password="your_db_password",
host="your_db_host",
port=your_db_port,
dbname="your_db_name",
logfile="path/to/your/logfile.log"
)
# Call setup to load the AGE extension commands
db.setup()
# Example usage
db.create_graph("TestGraph")
db.create_vertex_label("TestGraph", "Book")
book = Vertex(label="Book", properties={"Title": "The Hobbit"})
db.create_vertex("TestGraph", vertex)
author = Vertex(label="Author", properties={"Name": "J.R.R.Tolkien"})
wrote = Edge(label="WROTE", from_vertex=author, to_vertex=book)
db.create_edge("TestGraph", wrote)
```
## Testing
This repo contains the `tests` folder, which includes a bash script, a python script, and the log file of the test. Executing the bash script will pull the apache/age docker image and run it on the background. Then, it is going to call the python test script and execute it. Finally, it stops and removes the container.
## Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss what you would like to change.
## For more information about Apache AGE
* Apache Age Website: https://age.apache.org/
* Github: https://github.com/apache/age
* Documentation: https://age.apache.org/age-manual/master/index.html
## License
[Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0)
Raw data
{
"_id": null,
"home_page": "https://github.com/MatheusFarias03/AGESimpleSQL",
"name": "age-simple-sql",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Matheus Farias de Oliveira Matsumoto",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/3b/2d/2a7e4f37bb411ef198b016d8337c644b26ea0dc67daf8367df6d82f1c4fb/age_simple_sql-0.3.3.tar.gz",
"platform": null,
"description": "# AGESimpleSQL\nAGESimpleSQL is a simple SQL wrapper for Apache AGE using `psycopg2` [connection pooling](https://www.psycopg.org/psycopg3/docs/advanced/pool.html). It supports operations such as creating and dropping graphs, creating vertex and edge labels, creating vertices and edges, retrieving graph and label information, and executing SQL and Cypher queries. It is not the official driver for Apache AGE.\n\n[Apache AGE](https://age.apache.org/) is a PostgreSQL extension that provides graph database functionality. The goal of the Apache AGE project is to create single storage that can handle both relational and graph model data so that users can use standard ANSI SQL along with openCypher, the Graph query language.\n\n\n## Usage\n```python\nfrom age_simple_sql import AGESimpleSQL\nfrom age_simple_sql.models import Vertex\n\n# Initialize the AGESimpleSQL instance\ndb = AGESimpleSQL(\n user=\"your_db_user\",\n password=\"your_db_password\",\n host=\"your_db_host\",\n port=your_db_port,\n dbname=\"your_db_name\",\n logfile=\"path/to/your/logfile.log\"\n)\n\n# Call setup to load the AGE extension commands\ndb.setup()\n\n# Example usage\ndb.create_graph(\"TestGraph\")\ndb.create_vertex_label(\"TestGraph\", \"Book\")\nbook = Vertex(label=\"Book\", properties={\"Title\": \"The Hobbit\"})\ndb.create_vertex(\"TestGraph\", vertex)\n\nauthor = Vertex(label=\"Author\", properties={\"Name\": \"J.R.R.Tolkien\"})\nwrote = Edge(label=\"WROTE\", from_vertex=author, to_vertex=book)\ndb.create_edge(\"TestGraph\", wrote)\n```\n\n## Testing\nThis repo contains the `tests` folder, which includes a bash script, a python script, and the log file of the test. Executing the bash script will pull the apache/age docker image and run it on the background. Then, it is going to call the python test script and execute it. Finally, it stops and removes the container.\n\n## Contributing\nContributions are welcome! Please submit a pull request or open an issue to discuss what you would like to change.\n\n## For more information about Apache AGE\n* Apache Age Website: https://age.apache.org/\n* Github: https://github.com/apache/age\n* Documentation: https://age.apache.org/age-manual/master/index.html\n\n## License\n[Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0)\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple SQL wrapper for Apache AGE using psycopg2 connection pooling.",
"version": "0.3.3",
"project_urls": {
"Homepage": "https://github.com/MatheusFarias03/AGESimpleSQL"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fb4d6a6b9a32787190722b29c0ed8b3148a6707a8f3d0e75c3e43ccef7952dee",
"md5": "b72ce5f47547746bdc66dbe94b367e6a",
"sha256": "4e2d62e0720461872fb62ea2089517cd1a2e6d2176b115b328bae30b6af4579b"
},
"downloads": -1,
"filename": "age_simple_sql-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b72ce5f47547746bdc66dbe94b367e6a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10423,
"upload_time": "2024-08-21T03:08:07",
"upload_time_iso_8601": "2024-08-21T03:08:07.037187Z",
"url": "https://files.pythonhosted.org/packages/fb/4d/6a6b9a32787190722b29c0ed8b3148a6707a8f3d0e75c3e43ccef7952dee/age_simple_sql-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3b2d2a7e4f37bb411ef198b016d8337c644b26ea0dc67daf8367df6d82f1c4fb",
"md5": "f8018953e3988a960a128540f2ebff29",
"sha256": "0b62086e6e646bb289b5290763463f070a0ba09b4391e4b2c8a1869ff99944b6"
},
"downloads": -1,
"filename": "age_simple_sql-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "f8018953e3988a960a128540f2ebff29",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10609,
"upload_time": "2024-08-21T03:08:08",
"upload_time_iso_8601": "2024-08-21T03:08:08.619842Z",
"url": "https://files.pythonhosted.org/packages/3b/2d/2a7e4f37bb411ef198b016d8337c644b26ea0dc67daf8367df6d82f1c4fb/age_simple_sql-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-21 03:08:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MatheusFarias03",
"github_project": "AGESimpleSQL",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "age-simple-sql"
}