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.24.tar.gz (5.2 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.24-py2-none-any.whl (8.5 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for campbel-0.0.24.tar.gz
Algorithm Hash digest
SHA256 da8469924ea639b708c414e528e3b7b71ceffbd7bd36e76425da7dc027d349e6
MD5 658cf24c2bdfbeb435c28c5bca3fc165
BLAKE2b-256 2401602eaf11f818f3b0ec4408acf5f20cfec4b0866b4be7aaa7920b50d868f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for campbel-0.0.24-py2-none-any.whl
Algorithm Hash digest
SHA256 758298a0583b26496a028acb5dbbf2be824efb6c88ef2ccbdca6a5cb8d40ba5e
MD5 97dc73ef8ff292827699fbc45788be9d
BLAKE2b-256 6d4b1a06b77a5f444397de32642355b27a73eedadbd9da942c3d6683329f9b05

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