Skip to main content

Convenient tool"),

Project description

pypi: https://pypi.python.org/pypi/campbel/0.0.7

便利モジュールです。

セットアップ
pip install campbel

チュートリアル
dbに接続しよう

from campbel.AWS import Rds as rds
rds = rds.Rds(
db_host = 'DBホスト',
db_user = 'DBユーザー',
db_password = 'DBパスワード',
db_name = 'DB名',
charset = 'utf-8',
)

これで接続完了!

インサートしよう
rds.insertExecute('user','name,age,message','"campbel",20,"hello"')
rds.dbClosed()
これは
INSERT INTO user (name,age,message) VALUES ("campbel",20,"hello")
と等価です。rds.dbClosed()はDBと接続を切ります。

次はデータをまとめて挿入してみましょう。辞書形式を配列にしましょう。 <-こっちを使うことを推奨します。
data_list_array = [
{'name':'ryu', age:27, 'massage':'こんにちは'},
{'name':'koumei', age:26, 'massage':'game'},
{'name':'hyuga', age:21, 'massage':'meshi'},
{'name':'kenjo', age:20, 'massage':'study'},
]
rds.insertListExecute('user', data_list_array)
rds.dbClosed()

これは
INSERT INTO user (name,age,message) VALUES ("ryu",27,"こんにちは")
INSERT INTO user (name,age,message) VALUES ("koumei",26,"game")
INSERT INTO user (name,age,message) VALUES ("hyuga",21,"meshi")
INSERT INTO user (name,age,message) VALUES ("kenjo",20,"study")
と等価です。

次はs3に接続してみよう!

from campbel.AWS import S3 as s3

s3 = spython setup.py register3.S3(
access_key = 'アクセスキー',
secret_access_key = 'シークレットアクセスキー',
bucket_name = 'バケット名',
)

これで接続完了です。

S3の/test/とディレクトリを作ろう。
s3.createDir('test/')

ローカルのa.txtをデータを入れよう!
s3.uploadFileToS3(a.txt, 'test/a.txt')



















<!-- -->


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

campbel-0.0.10.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

campbel-0.0.10-py2-none-any.whl (8.3 kB view details)

Uploaded Python 2

File details

Details for the file campbel-0.0.10.tar.gz.

File metadata

  • Download URL: campbel-0.0.10.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for campbel-0.0.10.tar.gz
Algorithm Hash digest
SHA256 7668ec05db8acc05080e55035db23b8b3f0719810b3a980051f27771e417e604
MD5 fce979db5241450706dd5d9d30e604c7
BLAKE2b-256 5e614755367c87a496a93f0eea17f1aa572bb0e1f28f1a699f04a1166ceb5d10

See more details on using hashes here.

File details

Details for the file campbel-0.0.10-py2-none-any.whl.

File metadata

File hashes

Hashes for campbel-0.0.10-py2-none-any.whl
Algorithm Hash digest
SHA256 8873d816355625ec4e46c11154c18f7c4b334955b05903b5657db65a50fc6c93
MD5 b5348b1166d02d749365c136c51cbc56
BLAKE2b-256 acca3e124d8b3237015d2c48dc009e611d193304b2194fd7a9b454d93aa50ca9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page