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.29.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.29-py2-none-any.whl (8.6 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for campbel-0.0.29.tar.gz
Algorithm Hash digest
SHA256 b5ebf1d52641055d1d3524c1b24a152ed4dd493e923aef35c8288030e99e8b8c
MD5 0ac03b0ad1092d23cf5dfd5aaf2e8b1f
BLAKE2b-256 9a0ed2daceab439135409815d117a463a7f545e76303dcccad560da673ae2793

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for campbel-0.0.29-py2-none-any.whl
Algorithm Hash digest
SHA256 aac0f1c72c83065fdb8801a12eb2942b66e5e0142a033545bc152e1e4aefc8d5
MD5 60721e3206d3849133c98b84b2dfa108
BLAKE2b-256 32face5020ef529033737b54946d36ec1b47dfe0fa43eda7a85feb207590faea

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