New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

SQLConn

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

SQLConn

This package facilitates easy SQL database integration.

pipPyPI
Version
0.0.7
Maintainers
1

SQLConn

한국어 버전(Korean Version)

SQLConn은 다양한 SQL 데이터베이스 관리 시스템(DBMS)에 연결하여 데이터를 쉽게 조작하고 관리할 수 있는 Python 패키지입니다. 이 패키지는 MySQL, PostgreSQL, Microsoft SQL Server 및 SQLite 데이터베이스에 대한 지원을 포함합니다.

기능

  • 여러 데이터베이스에 대한 통합된 인터페이스 제공
  • 데이터 조회 및 조작을 위한 간편한 함수 제공
  • 데이터베이스 쿼리 결과를 DataFrame으로 변환
  • CSV, Excel, TSV 파일로의 데이터 출력 지원
  • 다른 데이터베이스로의 데이터 이동 지원

연결가능한 데이터베이스

  • MySQL
  • PostgreSQL
  • Microsoft SQL Server
  • SQLite

설치 방법

파이썬과 pip가 설치된 환경에서 다음 명령어를 통해 SQLConn 패키지를 설치할 수 있습니다:

pip install SQLConn

클래스 소개

클래스명소개특이 사항
SQLConn다양한 SQL 데이터베이스 관리 시스템(DBMS)에 연결하기 위한 클래스입니다.추상 클래스입니다.
MYSQLConnMySQL 데이터베이스와의 연결을 관리합니다.SQLConn에게 상속 받았습니다
MSSQLConnMicrosoft SQL Server 데이터베이스와의 연결을 관리합니다.SQLConn에게 상속 받았습니다
PostgreSQLConnPostgreSQL 데이터베이스와의 연결을 관리합니다.SQLConn에게 상속 받았습니다
SQLiteConnSQLite 파일 기반 데이터베이스와의 연결을 관리합니다.SQLConn에게 상속 받았습니다

메소드 소개

메소드명소개특이사항
to_DataFrameSQL 쿼리를 실행하고 결과를 pandas DataFrame으로 반환합니다.Show, Select 커맨드만 가능
execute데이터베이스에서 SQL 쿼리를 실행하되 결과를 반환하지 않습니다.Show, Select 커맨드 사용 불가능
to_csvSQL 쿼리 결과를 CSV 파일로 저장합니다.Show, Select 커맨드만 가능
to_excelSQL 쿼리 결과를 Excel 파일로 저장합니다.Show, Select 커맨드만 가능
to_tsvSQL 쿼리 결과를 TSV 파일로 저장합니다.Show, Select 커맨드만 가능
to_sql다른 데이터베이스에 SQL 쿼리 결과를 저장합니다.Show, Select 커맨드만 가능
to_HTML해당 쿼리를 HTML코드로 변환합니다Show, Select 커맨드만 가능
URL데이터베이스 연결 URL을 제공합니다.읽기용 프로퍼티
engine데이터베이스 연결을 위한 SQLAlchemy 엔진을 제공합니다.읽기용 프로퍼티
conn데이터베이스 연결 객체를 제공합니다읽기용 프로퍼티

사용예제

각 데이터베이스 연결 객체를 생성하고 사용하는 기본적인 방법은 다음과 같습니다:

from SQLConn import MYSQLConn, PostgreSQLConn, MSSQLConn, SQLiteConn

# MySQL 데이터베이스에 연결
mysql_conn = MYSQLConn(host='your-host', user='your-user', password='your-password', database='your-database',port='your-port')

# MsSQL 데이터베이스에 연결
mssql_conn = MSSQLConn(host='your-host', user='your-user', password='your-password', database='your-database',port='your-port')

# PostgreSQL 데이터베이스에 연결
postgresql_conn = PostgreSQLConn(host='your-host', user='your-user', password='your-password', database='your-database',port='your-port')

# SQLite 데이터베이스에 연결
mssql_conn = SQLiteConn('your-host')

# 데이터 조회 예제
df = mysql_conn.to_DataFrame("SELECT * FROM your_table")
print(df)

로컬호스트에서 사용하기

로컬 호스트 데이터베이스 연결 객체를 생성하고 사용하는 기본적인 방법은 다음과 같습니다:

from SQLConn import MYSQLConn, PostgreSQLConn, MSSQLConn

# MySQL 데이터베이스에 연결
mysql_conn = MYSQLConn('your-password')

# MsSQL 데이터베이스에 연결
mssql_conn = MSSQLConn('your-password')

# PostgreSQL 데이터베이스에 연결
postgresql_conn = PostgreSQLConn('your-password')

# 데이터 조회 예제
df = mysql_conn.to_DataFrame("SELECT * FROM your_table")
print(df)

패키지 주소

  • github
  • pypi

English Version

SQLConn is a Python package that connects to various SQL database management systems (DBMS) to easily manipulate and manage data. This package includes support for MySQL, PostgreSQL, Microsoft SQL Server and SQLite databases.

function

  • Provides a unified interface to multiple databases
  • Provides simple functions for data inquiry and manipulation
  • Convert database query results to DataFrame
  • Supports data output to CSV, Excel, TSV files
  • Support for data movement to other databases

Support database

  • MySQL
  • PostgreSQL
  • Microsoft SQL Server
  • SQLite

How to install

In an environment where Python and pip are installed, you can install the SQLConn package using the following command:

pip install SQLConn

class info

class nameinfosignificant
SQLConnClass for connecting to various SQL database management systems (DBMS).It is an abstract class.
MYSQLConnManages MySQL database relationships.protected SQLConn
MSSQLConnManages connections to Microsoft SQL Server databases.protected SQLConn
PostgreSQLConnManages connections to PostgreSQL databases.protected SQLConn
SQLiteConnManages SQLite file-based database relationships.protected SQLConn

method info

method nameinfosignificant
to_DataFrameExecutes a SQL query and returns the results as a pandas DataFrame.Show, Select commands only
executeExecutes a SQL query on a database but returns no results.Show, Select command not available
to_csvSave the SQL query results as a CSV file.Show, Select commands only
to_excelSave the SQL query results as an Excel file.Show, Select commands only
to_tsvSave the SQL query results as a TSV file.Show, Select commands only
to_sqlStore SQL query results in another database.Show, Select commands only
to_HTMLConverts the SQL query results to HTML code.Show, Select 커맨드만 가능
URLProvide the database connection URL.get property
engineProvides SQLAlchemy engine for database connection.get property
connProvides the database connection object.get property

Example of use

The basic way to create and use each database connection object is as follows:

from SQLConn import MYSQLConn, PostgreSQLConn, MSSQLConn, SQLiteConn

# Connect to MySQL database
mysql_conn = MYSQLConn(host='your-host', user='your-user', password='your-password', database='your-database',port='your-port')

# Connect to MsSQL database
mssql_conn = MSSQLConn(host='your-host', user='your-user', password='your-password', database='your-database',port='your-port')

# Connect to PostgreSQL database
postgresql_conn = PostgreSQLConn(host='your-host', user='your-user', password='your-password', database='your-database',port='your-port')

# Connect to SQLite database
mssql_conn = SQLiteConn('your-host')

# Data query example
df = mysql_conn.to_DataFrame("SELECT * FROM your_table")
print(df)

Using on local host

The basic way to create and use a localhost database connection object is as follows:

from SQLConn import MYSQLConn, PostgreSQLConn, MSSQLConn

# Connect to MySQL database
mysql_conn = MYSQLConn('your-password')

# Connect to MsSQL database
mssql_conn = MSSQLConn('your-password')

# Connect to PostgreSQL database
postgresql_conn = PostgreSQLConn('your-password')

# Data query example
df = mysql_conn.to_DataFrame("SELECT * FROM your_table")
print(df)

package address

warning

This document was converted from the Korean version to English through a translator, so the meaning may be strange.

Keywords

mysql

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts