I am using following to copy selected feature from a Shapefile to a Dataset in a File Geodatabase
As you can see I tried to create layer from shapefile by doing
arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>inFeature<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'lyr'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
and then select the attribute like
arcpy<SPAN class="punctuation token">.</SPAN>SelectLayerByAttribute_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'lyr'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"NEW_SELECTION"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'"NAME_1" = \''</SPAN><SPAN class="operator token">+</SPAN>slectedCounty<SPAN class="operator token">+</SPAN><SPAN class="string token">'\' AND "NAME_2" = \''</SPAN><SPAN class="operator token">+</SPAN>county<SPAN class="operator token">+</SPAN><SPAN class="string token">'\''</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>