-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created Concept Entry for Python SQL Connectors #5683
base: main
Are you sure you want to change the base?
Conversation
## Setting Up a SQL Connector | ||
To use a SQL connector, you first need to set up your development environment. This includes installing the appropriate connector library for you database and making sure that youre database server is accessible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Setting Up a SQL Connector | |
To use a SQL connector, you first need to set up your development environment. This includes installing the appropriate connector library for you database and making sure that youre database server is accessible. | |
## Setting Up a SQL Connector | |
To use a SQL connector, you first need to set up your development environment. This includes installing the appropriate connector library for your database and ensuring that your database server is accessible. |
Made the sentence more readable by correcting the grammatical mistakes.
1. Install the Connector: | ||
- For MySQL: Use ```pip install mysql-connector-python```. | ||
- For PostgreSQL: Use ```pip install psycopg2``` | ||
- For SQLite: No installation is needed; it is built into Python's standard library. | ||
|
||
2. Set Up the Database | ||
- Make sure the database server is running and accessible. | ||
- Create or access an exisiting database. | ||
|
||
3. Import the Connector Library | ||
Use the appropriate Python module to work with the database, such as ```mysql.connector``` for MySQL or ```sqlite3``` for SQLite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Install the Connector: | |
- For MySQL: Use ```pip install mysql-connector-python```. | |
- For PostgreSQL: Use ```pip install psycopg2``` | |
- For SQLite: No installation is needed; it is built into Python's standard library. | |
2. Set Up the Database | |
- Make sure the database server is running and accessible. | |
- Create or access an exisiting database. | |
3. Import the Connector Library | |
Use the appropriate Python module to work with the database, such as ```mysql.connector``` for MySQL or ```sqlite3``` for SQLite. | |
1. Install the Connector: | |
- For MySQL: Use ```pip install mysql-connector-python```. | |
- For PostgreSQL: Use ```pip install psycopg2```. | |
- For SQLite: No installation is needed; it is built into Python's standard library. | |
2. Set Up the Database | |
- Ensure the database server is running and accessible. | |
- Create or access an existing database. | |
3. Import the Connector Library | |
Use the appropriate Python module to work with the database, such as ```mysql.connector``` for MySQL or ```sqlite3``` for SQLite. |
**General Workflow:** | ||
- Import the connector library. | ||
- Use the `connect()` method to establish a connection. | ||
- Handle connection errors with try-except blocks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**General Workflow:** | |
- Import the connector library. | |
- Use the `connect()` method to establish a connection. | |
- Handle connection errors with try-except blocks. |
Removed the redundant part
**Query Execution:** | ||
|
||
- Use `cursor.execute()` to run queries. | ||
- Use `cursor.fetchall()` to fetch data for SELECT queries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Query Execution:** | |
- Use `cursor.execute()` to run queries. | |
- Use `cursor.fetchall()` to fetch data for SELECT queries. | |
**Query Execution:** | |
- Use `cursor.execute()` to execute SQL queries. | |
- Use `cursor.fetchall()` to fetch all rows from a `SELECT` query. |
Description
Issue Solved
Closes #5633
Type of Change
This pull request adds documentation for the
mysql-connector-python
library, including examples for setting up connections and executing SQL queries.Checklist
main
branch.Issues Solved
section.