sql   74272

« earlier    

Free Programming Books – GoalKicker.com
These "books" are edited collections of StackOverflow posts.
programmer  Programming  note  notes  book  books  ebook  ebooks  bash  linux  c  python  sql  git  mssql  MySQL  stackoverflow 
3 hours ago by sharjeelsayed
Advanced SQL window functions quiz
Advanced SQL Tutorial for SQL Window Functions.
learning  sql  databases  advanced  quiz 
12 hours ago by mjlassila
python - get table columns from sqlAlchemy table model - Stack Overflow | https://stackoverflow.com/
You get all of the columns from __table__.columns:
<code class="language-python">myTable.__table__.columns</code>

or
<code class="language-python">myTable.__table__.c</code>

The columns would be in format myTable.col1 (table name is included). If you want just column names, get the .key for each column:
<code class="language-python">
[column.key for column in myTable.__table__.columns]
</code>
python  sqlalchemy  dba  sql  solution  reference  dammitbrain 
20 hours ago by kme
Sqlalchemy: Truncate all tables | https://gist.github.com/
In order to get the Table instance, use ModelName.__table__. The '.delete()' method on the Table is the same as a SQL 'TRUNCATE TABLE tablename', except you don't have to do any introspection (or hard-code) the table name.

<code class="language-python">
def truncate_db(engine):
# delete all table data (but keep tables)
# we do cleanup before test 'cause if previous test errored,
# DB can contain dust
meta = MetaData(bind=engine, reflect=True)
con = engine.connect()
trans = con.begin()
con.execute('SET FOREIGN_KEY_CHECKS = 0;')
for table in meta.sorted_tables:
con.execute(table.delete())
con.execute('SET FOREIGN_KEY_CHECKS = 1;')
trans.commit()</code>
sqlalchemy  dba  database  sql  python  solution 
yesterday by kme

« earlier    

related tags

2007  2009  administration  advanced  airbnb  amazon  analysis  analytics  apache  architecture  article  attributes  aurora  aws  bash  bestpractices  bi  book  bookmarks_bar  books  c  choice  clustering  code  column  columnar  comic  common_table_expressions  community  comparison  configuration  count  csv  dammitbrain  dashboard  data-model  data-relationships  data  datab  databas  database  databases  db  db2  dba  dbms  dev  development  diff  distributed  django  ebook  ebooks  etl  f#  floss  from_hn  fts  full  functional  git  github  go  golang  gui  haskell  howto  infrastructure  injection  install  java  jdbc  joins  js  json  learn  learning  linq  linux  manager  microsoft  migrations  mongodb  mssql  mysql  name  node  nosql  note  notes  numeric  online  openedge  opensource  optimization  oracle  pandas  performance  postgres  postgresql  powershell  prefetch  programmer  programming  proxy  python  ql  queries  query  quiz  r  rdbms  rds  reference  relational_tables  rosetta_code  runtime  sccm  search  security  server  service  sharepoint  software  solution  spark  sqlalchemy  sqlite  sqlserver  stackoverflow  streaming  style-guide  sysadmin  text  timeseries  tip  tool  tool_builder  toolkit  tools  toread  tuning  tutorial  unix  user  visual_programming  visualization  work  xkcd  xml 

Copy this bookmark:



description:


tags: